dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Set-DbaCmConnection

Configures a connection object for use in remote computer management. This function will either create new records for computers that have no connection registered so far, or it will configure existing connections if already present.

As such it can be handy in making bulk-edits on connections or manually adjusting some settings.

Screenshots

dbatools-Set-DbaCmConnection

Examples

Retrieves the already existing connection to sql2014, removes the list of not working credentials and configures it to default to the credentials of the logged on user.

Get-DbaCmConnection sql2014 | Set-DbaCmConnection -ClearBadCredential -UseWindowsCredentials

Removes the credentials stored in $cred from all connections’ list of “known to not work” credentials. Handy to update changes in privilege.

Get-DbaCmConnection | Set-DbaCmConnection -RemoveBadCredential $cred

At first, the current cached connections are stored in an xml file. At a later time – possibly in the profile when starting the console again – those connections are imported again and applied again to the connection cache.

In this example, the configuration settings will also be reset, since after reimport those will be set to explicit, rather than deriving them from the global settings.

In many cases, using the default settings is desirable. For specific settings, use New-DbaCmConnection as part of the profile in order to explicitly configure a connection.

Get-DbaCmConnection | Export-Clixml .\connections.xml
Import-Clixml .\connections.xml | Set-DbaCmConnection -ResetConfiguration

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter and his blog.

Get-Help

From PowerShell, execute Get-Help Set-DbaCmConnection -Detailed for more information on this function.

Source Code

Want to see the source code? View Set-DbaCmConnection.ps1 on GitHub
 

Related commands