commands

^

Add-DbaRegServerGroup

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Synopsis

Adds registered server groups to SQL Server Central Management Server (CMS)

Description

Adds registered server groups to SQL Server Central Management Server (CMS). If you need more flexibility, look into Import-DbaRegServer which accepts multiple kinds of input and allows you to add reg servers and groups from different CMS.

Syntax

Add-DbaRegServerGroup
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [-Name] <String>
    [[-Description] <String>]
    [[-Group] <String>]
    [[-InputObject] <ServerGroup[]>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Add-DbaRegServerGroup -SqlInstance sql2012 -Name HR

Creates a registered server group called HR, in the root of sql2012's CMS

Example: 2
PS C:\> Add-DbaRegServerGroup -SqlInstance sql2012, sql2014 -Name sub-folder -Group HR

Creates a registered server group on sql2012 and sql2014 called sub-folder within the HR group

Example: 3
PS C:\> Get-DbaRegServerGroup -SqlInstance sql2012, sql2014 -Group HR | Add-DbaRegServerGroup -Name sub-folder

Creates a registered server group on sql2012 and sql2014 called sub-folder within the HR group of each server

Required Parameters

-Name

The name of the registered server group.

Alias
Required True
Pipeline false
Default Value

Optional Parameters

-SqlInstance

The target SQL Server instance

Alias
Required False
Pipeline false
Default Value
-SqlCredential

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
-Description

The description for the registered server group

Alias
Required False
Pipeline false
Default Value
-Group

The SQL Server Central Management Server group. If no groups are specified, the new group will be created at the root. You can pass sub groups using the '' to split the path. Group\SubGroup will create both folders. Folder 'SubGroup' under 'Group' folder.

Alias
Required False
Pipeline false
Default Value
-InputObject

Allows results from Get-DbaRegServerGroup to be piped in

Alias
Required False
Pipeline true (ByValue)
Default Value
-EnableException

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
-WhatIf

Shows what would happen if the command were to run. No actions are actually performed.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

Prompts you for confirmation before executing any changing operations within the command.

Alias cf
Required False
Pipeline false
Default Value

 

Want to see the source code for this command? Check out Add-DbaRegServerGroup on GitHub.
Want to see the Bill Of Health for this command? Check out Add-DbaRegServerGroup.