< Back
Repair-DbaInstanceName
Post
NAME Repair-DbaInstanceName
SYNOPSIS
Renames @@SERVERNAME to match with the Windows name.
SYNTAX
Repair-DbaInstanceName [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>
[[-SqlCredential] <Pscredential>] [-AutoFix <Switch>] [-Force <Switch>] [-EnableException <Switch>]
[<CommonParameters>]
DESCRIPTION
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.
https://www.mssqltips.com/sqlservertip/ ... r-machine/
PARAMETERS
-AutoFix [<Switch>]
If this switch is enabled, the repair will be performed automatically.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Force [<Switch>]
If this switch is enabled, most confirmation prompts will be skipped.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: SPN
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Repair-DbaInstanceName -SqlInstance sql2014
Checks to see if the server name is updatable and changes the name with a number of prompts.
-------------------------- EXAMPLE 2 --------------------------
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.
-------------------------- EXAMPLE 3 --------------------------
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.
RELATED LINKS
https://dbatools.io/Repair-DbaInstanceName
SYNOPSIS
Renames @@SERVERNAME to match with the Windows name.
SYNTAX
Repair-DbaInstanceName [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>
[[-SqlCredential] <Pscredential>] [-AutoFix <Switch>] [-Force <Switch>] [-EnableException <Switch>]
[<CommonParameters>]
DESCRIPTION
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.
https://www.mssqltips.com/sqlservertip/ ... r-machine/
PARAMETERS
-AutoFix [<Switch>]
If this switch is enabled, the repair will be performed automatically.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Force [<Switch>]
If this switch is enabled, most confirmation prompts will be skipped.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: SPN
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Repair-DbaInstanceName -SqlInstance sql2014
Checks to see if the server name is updatable and changes the name with a number of prompts.
-------------------------- EXAMPLE 2 --------------------------
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.
-------------------------- EXAMPLE 3 --------------------------
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.
RELATED LINKS
https://dbatools.io/Repair-DbaInstanceName