< Back

Test-DbaInstanceName

Mon Jan 13, 2020 6:09 pm

NAME Test-DbaInstanceName



SYNOPSIS

Tests to see if it's possible to easily rename the server at the SQL Server instance level, or if it even needs to

be changed.





SYNTAX

Test-DbaInstanceName [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]

<Pscredential>] [-ExcludeSsrs <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 helps determine if your OS and SQL Server names match, and whether a rename is required.



It then checks conditions that would prevent a rename, such as database mirroring and replication.



https://www.mssqltips.com/sqlservertip/ ... r-machine/





PARAMETERS

-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



-ExcludeSsrs [<Switch>]

If this switch is enabled, checking for SQL Server Reporting Services 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

System.Collections.ArrayList





NOTES





Tags: SPN, ServerName

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:\\>Test-DbaInstanceName -SqlInstance sqlserver2014a



Returns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a.

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-DbaInstanceName -SqlInstance sqlserver2014a, sql2016



Returns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016.

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Test-DbaInstanceName -SqlInstance sqlserver2014a, sql2016 -ExcludeSsrs



Returns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016, but skips

validating if SSRS is installed on both instances.

-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Test-DbaInstanceName -SqlInstance sqlserver2014a, sql2016 | Select-Object *



Returns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016.

If a Rename is required, it will also show Updatable, and Reasons if the server name is not updatable.



RELATED LINKS

https://dbatools.io/Test-DbaInstanceName