< Back

Add-DbaRegServer

Mon Jan 13, 2020 9:12 am

NAME Add-DbaRegServer



SYNOPSIS

Adds registered servers to SQL Server Central Management Server (CMS) or Local Server Groups





SYNTAX

Add-DbaRegServer [[-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>] [[-SqlCredential]

<Pscredential>] [[-ServerName] <String>] [[-Name] <String>] [[-Description] <String>] [[-Group] <System.Object>]

[[-ActiveDirectoryTenant] <String>] [[-ActiveDirectoryUserId] <String>] [[-ConnectionString] <String>]

[[-OtherParams] <String>] [[-InputObject] <Microsoft.SqlServer.Management.RegisteredServers.ServerGroup[]>]

[[-ServerObject] <Microsoft.SqlServer.Management.Smo.Server[]>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Adds registered servers to SQL Server Central Management Server (CMS) or Local Server Groups. If you need more

flexibility, look into Import-DbaRegServer which



accepts multiple kinds of input and allows you to add reg servers from different CMSes.





PARAMETERS

-ActiveDirectoryTenant [<String>]

Active Directory Tenant



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ActiveDirectoryUserId [<String>]

Active Directory User id



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ConnectionString [<String>]

SQL Server connection string



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Description [<String>]

Adds a description for the registered server



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



-Group [<System.Object>]

Adds the registered server to a specific group.

If group does not exist it will be created



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-InputObject [<Microsoft.SqlServer.Management.RegisteredServers.ServerGroup[]>]

Allows the piping of a registered server group



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Name [<String>]

Name is basically the nickname in SSMS Registered Server interface (labeled Registered Server Name)



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-OtherParams [<String>]

Additional parameters to append to the connection string



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ServerName [<String>]

Server Name is the actual SQL instance name (labeled Server Name)



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ServerObject [<Microsoft.SqlServer.Management.Smo.Server[]>]

SMO Server Objects (from Connect-DbaInstance)



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 if a CMS is used



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: RegisteredServer, CMS

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:\\>Add-DbaRegServer -SqlInstance sql2008 -ServerName sql01



Creates a registered server on sql2008's CMS which points to the SQL Server, sql01. When scrolling in CMS, the

name "sql01" will be visible.

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



PS C:\\>Add-DbaRegServer -ServerName sql01



Creates a registered server in Local Server Groups which points to the SQL Server, sql01. When scrolling in

Registered Servers, the name "sql01" will be visible.

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



PS C:\\>Add-DbaRegServer -SqlInstance sql2008 -ServerName sql01 -Name "The 2008 Clustered Instance" -Description

"HR's Dedicated SharePoint instance"



Creates a registered server on sql2008's CMS which points to the SQL Server, sql01. When scrolling in CMS, "The

2008 Clustered Instance" will be visible.

Clearly this is hard to explain

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



PS C:\\>Add-DbaRegServer -SqlInstance sql2008 -ServerName sql01 -Group hr\\Seattle



Creates a registered server on sql2008's CMS which points to the SQL Server, sql01. When scrolling in CMS, the

name "sql01" will be visible within the Seattle group which is in the hr group.

-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Connect-DbaInstance -SqlInstance dockersql1 -SqlCredential sqladmin | Add-DbaRegServer -ServerName

mydockerjam



Creates a registered server called "mydockerjam" in Local Server Groups that uses SQL authentication and points to

the server dockersql1.



RELATED LINKS

https://dbatools.io/Add-DbaRegServer