Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out New-DbaClientAlias on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaClientAlias.
Creates/updates a sql alias for the specified server - mimics cliconfg.exe
Creates/updates a SQL Server alias by altering HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client
New-DbaClientAlias
[[-ComputerName] <DbaInstanceParameter[]>]
[[-Credential] <PSCredential>]
[-ServerName] <DbaInstanceParameter>
[-Alias] <String>
[[-Protocol] <String>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> New-DbaClientAlias -ServerName sqlcluster\sharepoint -Alias sp
Creates a new TCP alias on the local workstation called sp, which points sqlcluster\sharepoint
PS C:\> New-DbaClientAlias -ServerName 'sqlcluster,14443' -Alias spinstance
Creates a new TCP alias on the local workstation called spinstance, which points to sqlcluster, port 14443.
PS C:\> New-DbaClientAlias -ServerName sqlcluster\sharepoint -Alias sp -Protocol NamedPipes
Creates a new NamedPipes alias on the local workstation called sp, which points sqlcluster\sharepoint
The target SQL Server
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The alias to be created
Alias | |
Required | True |
Pipeline | false |
Default Value |
The target computer where the alias will be created
Alias | |
Required | False |
Pipeline | false |
Default Value | $env:COMPUTERNAME |
Allows you to login to remote computers using alternative credentials
Alias | |
Required | False |
Pipeline | false |
Default Value |
The protocol for the connection, either TCPIP or NetBIOS. Defaults to TCPIP.
Alias | |
Required | False |
Pipeline | false |
Default Value | TCPIP |
Accepted Values | TCPIP,NamedPipes |
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 |