Share via


Set-SCOMLocation

Associates agent-managed computers, management servers, or resource pools with a location.

Syntax

FromAgent (Default)

Set-SCOMLocation
    [-Agent] <AgentManagedComputer[]>
    -Location <EnterpriseManagementObject>
    [-PassThru]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

FromManagementServer

Set-SCOMLocation
    [-ManagementServer] <ManagementServer[]>
    -Location <EnterpriseManagementObject>
    [-PassThru]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

FromPool

Set-SCOMLocation
    [-Pool] <ManagementServicePool[]>
    -Location <EnterpriseManagementObject>
    [-PassThru]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-SCOMLocation cmdlet associates one or more agent-managed computers, management servers, or resource pools with a location. This cmdlet removes a current association, if one exists. The Web Application Availability Monitoring Summary Map Dashboard displays state information for agents, management servers, and resource pools associated with a location.

You can remove an association by using the Remove-SCOMLocation cmdlet. You can create a location by using the New-SCOMLocation cmdlet.

By default, this cmdlet uses the active persistent connection to a management group. Use the SCSession parameter to specify a different persistent connection. You can create a temporary connection to a management group by using the ComputerName and Credential parameters. For more information, type Get-Help about_OpsMgr_Connections.

Examples

Example 1: Associate an agent with a location

PS C:\>$Location = Get-SCOMLocation -DisplayName "Seattle, WA"
PS C:\> $Agent = Get-SCOMAgent -Name "Server01.Contoso.com"
PS C:\> Set-SCOMLocation -Location $Location -Agent $Agent

This example associates an agent-managed computer named Sever01.Contoso.com with the location Seattle, WA. The first command gets the location object that has the display name of Seattle, WA, and then stores the object in the $Location variable.

The second command gets the agent object named Server01.Contoso.com, and then stores the object in the $Agent variable.

The third command associates the location stored in the $Location variable with the agent-managed computer stored in the $Agent variable. If you previously associated this agent-managed computer with a location, the command removes that association.

Example 2: Associate a management server with a location

PS C:\>$Location = Get-SCOMLocation -DisplayName "New York, NY"
PS C:\> $MgmtServer = Get-SCOMManagementServer -Name "MgmtServer01.Contoso.com"
PS C:\> Set-SCOMLocation -Location $Location -ManagementServer $MgmtServer

This example associates a management server named MgmtServer01.Contoso.com with the location New York, NY. The first command gets the location object that has the display name of New York, NY, and then stores the object in the $Location variable.

The second command gets the management server object named MgmtServer01.Contoso.com, and stores the object in the $MgmtServer variable.

The third command associates the location stored in the $Location variable with the management server stored in the $MgmtServer variable. If you previously associated this management server with a location, the command removes that association.

Example 3: Associate a resource pool to a location

PS C:\>$Location = Get-SCOMLocation -DisplayName "Paris, FR"
PS C:\> $Pool = Get-SCOMResourcePool -Name "Notifications Resource Pool"
PS C:\> Set-SCOMLocation -Location $Location -Pool $Pool

This example associates a resource pool named Notifications Resource Pool with the location Paris, FR. The first command gets the location object that has the display name Paris, FR, and then stores the object in the $Location variable.

The second command gets the resource pool named Notifications Resource Pool, and then stores the object in the $Pool variable.

The third command associates the location stored in the $Location variable with the resource pool stored in the $Pool variable. If you previously associated the resource pool with a location, the command removes that association.

Parameters

-Agent

Specifies an array of AgentManagedComputer objects. To obtain an AgentManagedComputer object, use the Get-SCOMAgent cmdlet.

Parameter properties

Type:

AgentManagedComputer[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAgent
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies an array of names of computers. The cmdlet establishes temporary connections with management groups for these 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.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

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.

Parameter properties

Type:PSCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

Specifies a location as an EnterpriseManagementObject object. To obtain a location, use the Get-SCOMLocation cmdlet.

Parameter properties

Type:EnterpriseManagementObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ManagementServer

Specifies an array of management server objects. To obtain a management server object, use the Get-SCOMManagementServer cmdlet.

Parameter properties

Type:

ManagementServer[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromManagementServer
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Indicates that the cmdlet creates or modifies an object that a command can use in the pipeline. By default, this cmdlet does not generate any output.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Pool

Specifies an array of resource pool objects. To obtain a resource pool object, use the Get-SCOMResourcePool cmdlet.

Parameter properties

Type:

ManagementServicePool[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromPool
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-SCSession

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

Parameter properties

Type:

Connection[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.