Add-SCOMADAgentAssignment

Add-SCOMADAgentAssignment

Assigns AD DS agent-managed computers to the management group.

Syntax

Parameter Set: Default
Add-SCOMADAgentAssignment [-Domain] <String> [-PrimaryServer] <ManagementServer> [-LdapQuery] <String> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-Exclude <String[]> ] [-FailoverServer <ManagementServer[]> ] [-RunAsProfile <ManagementPackSecureReference> ] [-SCSession <Connection[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-SCOMADAgentAssignment cmdlet assigns one or more Active Directory Domain Services (AD DS) agent-managed computers to the System Center 2012 – Operations Manager management group.

Before you use this cmdlet to assign agent-managed computers to the management group, use MOMADAdmin.exe to create an AD DS container for an Operations Manager management group in the domain of the computers.

Parameters

-ComputerName<String[]>

Specifies an array of names of computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type the computer name, localhost, or a dot (.).

The System Center Data Access service must be running on the computer. If you do not specify a computer, the cmdlet uses the computer for the current management group connection.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies a PSCredential object for the management group connection. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

If you specify a computer in the ComputerName parameter, use an account that has access to that computer. The default is the current user.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Domain<String>

Specifies the name of the domain or domain controller in which the target agents reside.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Exclude<String[]>

Specifies an array of names of computers. Operations Manager excludes the computers that you specify from the agent assignment.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FailoverServer<ManagementServer[]>

Specifies an array of names of ManagementServer objects. This parameter specifies the management servers that Operations Manager uses as failovers for the target agents.

By default, Operations Manager uses all non-gateway management servers for failover.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LdapQuery<String>

Specifies the LDAP query in the domain which selects the target agent computers.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PrimaryServer<ManagementServer>

Specifies a ManagementServer object. This parameter specifies the primary management server for the target agent-managed computer. To obtain a ManagementServer object, use the Get-SCOMManagementServer cmdlet.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsProfile<ManagementPackSecureReference>

Specifies the Run As profile that Operations Manager uses to run AD DS query workflow.

The Run As profile must be associated with the same RunAs account that you specify when you run MOMADAdmin.exe to create an AD DS container for a System Center 2012 – Operations Manager management group.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SCSession<Connection[]>

Specifies an array of Connection objects. To obtain a Connection object, use the Get-SCOMManagementGroupConnection cmdlet.

A connection object represents a connection to a management server. The default is the current management group connection.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Assign AD DS agent-managed computers to the management group

This example assigns an AD DS agent-managed computer to the management group.

The first command gets the management server object named DivMgmtSvr01.fabrikam.net, and stores the object in the $PrimaryServer variable.

The second command specifies an LDAP query that selects computers with names like SQLServer*.fabrikam.net, and stores the object in the $Ldap variable.

The third command assigns the AD DS agent-managed computers stored in $Ldap to the management group in the fabrikam.net domain. The command excludes the computer named SQLServer05.fabrikam.net from the management group.

PS C:\> $PrimaryServer = Get-SCOMManagementServer -Name "DivMgmtSvr01.fabrikam.net"
PS C:\> $Ldap = "(&amp;(sAMAccountType=805306369)(name=SQLServer*))"
PS C:\> Add-SCOMADAgentAssignment -Domain "fabrikam.net" -PrimaryServer $PrimaryServer -LdapQuery $Ldap -Exclude "SQLServer05.fabrikam.net"

Example 2: Set failovers for an AD DS agent assignment

This example assigns an AD DS agent-managed computer to the management group and sets the failovers for the agent.

The first command gets the management server object named DivMgmtSvr01.fabrikam.net, and stores the object in the $PrimaryServer variable.

The second command gets the management servers with a name like FabrikamSecondary*.fabrikam.net, and stores the objects in the $Failovers variable.

The third command gets the Runs As profile object named "Active Directory Based Agent Assignment Account" and stores the object in the $RunAs variable.

The fourth command specifies an LDAP query that selects computers with names like SQLServer*.fabrikam.net, and stores the result in the $Ldap variable.

The fifth command assigns the AD DS agent-managed computers stored in $Ldap to the management group in the fabrikam.net domain. The command specifies the primary management server stored in $PrimaryServer for the agent-managed computers. The command specifies the management servers stored in $Failovers as failovers for the agent-managed computers. The command specifies the Run As profile stored in $RunAs for the agent-managed computers.

PS C:\> $PrimaryServer = Get-SCOMManagementServer -Name "DivMgmtSvr01.fabrikam.net"
PS C:\> $Failovers = Get-SCOMManagementServer -Name "FabrikamSecondary*.fabrikam.net"
PS C:\> $RunAs = Get-SCOMRunAsProfile -Name "Active Directory Based Agent Assignment Account"
PS C:\> $Ldap = "(&amp;(sAMAccountType=805306369)(name=SQLServer*))"
PS C:\> Add-SCOMADAgentAssignment -Domain "fabrikam.net" -PrimaryServer $PrimaryServer -LdapQuery $Ldap -FailoverServer $Failovers -RunAsProfile $RunAs

Get-SCOMADAgentAssignment

Update-SCOMADAgentAssignment

Remove-SCOMADAgentAssignment