Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaClientAlias on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaClientAlias.
Removes SQL Server client aliases from Windows registry on local or remote computers
Removes SQL Server client aliases from the Windows registry by deleting entries from both 32-bit and 64-bit registry locations.
Client aliases redirect SQL Server connection requests to different servers or instances, but outdated or incorrect aliases can cause connection failures.
This function provides a programmatic way to clean up these aliases when the deprecated cliconfg.exe utility is not available or when managing multiple computers remotely.
Commonly used when decommissioning servers, updating connection strings, or troubleshooting connectivity issues caused by stale alias configurations.
Remove-DbaClientAlias
[[-ComputerName] <DbaInstanceParameter[]>]
[[-Credential] <PSCredential>]
[-Alias] <String[]>
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaClientAlias -ComputerName workstationX -Alias sqlps
Removes the sqlps SQL Client alias on workstationX
PS C:\> Get-DbaClientAlias | Remove-DbaClientAlias
Removes all SQL Server client aliases on the local computer
Specifies the SQL Server client alias name(s) to remove from both 32-bit and 64-bit registry locations.
Use this to clean up outdated aliases that redirect connections to decommissioned servers or incorrect instances.
Accepts multiple alias names for bulk cleanup operations.
Alias | AliasName |
Required | True |
Pipeline | true (ByPropertyName) |
Default Value |
Specifies the target computer(s) where SQL Server client aliases will be removed from the Windows registry.
Use this when you need to clean up aliases on remote workstations or application servers.
Defaults to the local computer if not specified.
Alias | |
Required | False |
Pipeline | true (ByPropertyName) |
Default Value | $env:COMPUTERNAME |
Allows you to login to remote computers using alternative credentials
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |