Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Add-DbaRegServer on GitHub.
Want to see the Bill Of Health for this command? Check out Add-DbaRegServer.
Adds registered servers to SQL Server Central Management Server (CMS) or Local Server Groups
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.
Add-DbaRegServer
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-ServerName] <String>]
[[-Name] <String>]
[[-Description] <String>]
[[-Group] <Object>]
[[-ActiveDirectoryTenant] <String>]
[[-ActiveDirectoryUserId] <String>]
[[-ConnectionString] <String>]
[[-OtherParams] <String>]
[[-InputObject] <ServerGroup[]>]
[[-ServerObject] <Server[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
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.
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.
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 ;)
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.
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.
The target SQL Server instance if a CMS is used
Alias | |
Required | False |
Pipeline | false |
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 |
Server Name is the actual SQL instance name (labeled Server Name)
Alias | |
Required | False |
Pipeline | false |
Default Value |
Name is basically the nickname in SSMS Registered Server interface (labeled Registered Server Name)
Alias | |
Required | False |
Pipeline | false |
Default Value | $ServerName |
Adds a description for the registered server
Alias | |
Required | False |
Pipeline | false |
Default Value |
Adds the registered server to a specific group.
If group does not exist it will be created
Alias | |
Required | False |
Pipeline | false |
Default Value |
Active Directory Tenant
Alias | |
Required | False |
Pipeline | false |
Default Value |
Active Directory User id
Alias | |
Required | False |
Pipeline | false |
Default Value |
SQL Server connection string
Alias | |
Required | False |
Pipeline | false |
Default Value |
Additional parameters to append to the connection string
Alias | |
Required | False |
Pipeline | false |
Default Value |
Allows the piping of a registered server group
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
SMO Server Objects (from Connect-DbaInstance)
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
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 |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |