Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Repair-DbaInstanceName on GitHub.
Want to see the Bill Of Health for this command? Check out Repair-DbaInstanceName.
Renames @@SERVERNAME to match with the Windows name.
When a SQL Server's host OS is renamed, the SQL Server should be as well. This helps with Availability Groups and Kerberos.
This command renames @@SERVERNAME to match with the Windows name. The new name is automatically determined. It does not matter if you use an alias to connect to the SQL instance.
If the automatically determined new name matches the old name, the command will not run.
Repair-DbaInstanceName
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[-AutoFix]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Repair-DbaInstanceName -SqlInstance sql2014
Checks to see if the server name is updatable and changes the name with a number of prompts.
PS C:\> Repair-DbaInstanceName -SqlInstance sql2014 -AutoFix
Checks to see if the server name is updatable and automatically performs the change. Replication or mirroring will be broken if necessary.
PS C:\> Repair-DbaInstanceName -SqlInstance sql2014 -AutoFix -Force
Checks to see if the server name is updatable and automatically performs the change, bypassing most prompts and confirmations. Replication or mirroring will be broken if necessary.
The target SQL Server instance or instances.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, the repair will be performed automatically.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, most confirmation prompts will be skipped.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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 |