Created
October 7, 2022 18:28
-
-
Save AScriver/745d3f47b2f5e7c26e0d6cdbcead7c5d to your computer and use it in GitHub Desktop.
Dumps connection strings saved in SSMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Invoke-Sqlcmd | Out-Null | |
Get-ChildItem 'SQLSERVER:\sqlregistration\Database Engine Server Group' -Recurse ` | |
| Where-Object {$_ -is [Microsoft.SqlServer.Management.RegisteredServers.RegisteredServer]} ` | |
| Select-Object DisplayName, ConnectionString ` | |
| ConvertTo-Json -Depth 3 -Compress ` | |
| Out-File -FilePath .\output.json | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment