Get-SCOMLocation

Get-SCOMLocation

Gets locations.

Syntax

Parameter Set: Empty
Get-SCOMLocation [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromAgent
Get-SCOMLocation [-Agent] <AgentManagedComputer[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromDisplayName
Get-SCOMLocation [-DisplayName] <String[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromEMOIdParameterSetName
Get-SCOMLocation -Id <Guid[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromManagementServer
Get-SCOMLocation [-ManagementServer] <ManagementServer[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromPool
Get-SCOMLocation [-Pool] <ManagementServicePool[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCOMLocation cmdlet gets locations. Specify locations to get by display name or ID, or by specifying associated agents, management servers, or resource pools.

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.

Parameters

-Agent<AgentManagedComputer[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ComputerName<String[]>

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.

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

-DisplayName<String[]>

Specifies an array of display names. Values for this parameter depend on which localized management packs you import and the locale of the user that runs Windows PowerShell.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Id<Guid[]>

Specifies an array of unique IDs of locations.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ManagementServer<ManagementServer[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Pool<ManagementServicePool[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SCSession<Connection[]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

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: Get a location by display name

This command gets the location that has the display name Seattle, WA.

PS C:\> Get-SCOMLocation -DisplayName "Seattle, WA"

Example 2: Get the location of an agent-managed computer

This example gets a location for an agent-managed computer. The first command gets the agent object for an agent-managed computer named Server01.Contoso.com and then stores the object in the $Agent variable.

The second command gets the location for the agent object stored in the $Agent variable.

PS C:\> $Agent = Get-SCOMAgent –Name "Server01.Contoso.com"
PS C:\> Get-SCOMLocation –Agent $Agent

Example 3: Get the location of a management server

This example gets the location for a management server named MgmtServer01.Contoso.com. The first command gets the management server object for the management server named MgmtServer01.Contoso.com, and then stores the object in the $MgmtSvr variable.

The second command gets the location for the management server object stored in the $MgmtSvr variable.

PS C:\> $MgmtSvr = Get-SCOMManagementServer -Name "MgmtServer01.Contoso.com"
PS C:\> Get-SCOMLocation -ManagementServer $MgmtSvr

Example 4: Get the location of a resource pool

This example gets a location for the resource pool named Pool01. The first command gets the resource pool object for the resource pool named Pool01 and stores the object in the $Pool variable.

The second command gets the location for the pool stored in the $Pool variable.

PS C:\> $Pool = Get-SCOMResourcePool -Name "Pool01"
PS C:\> Get-SCOMLocation -Pool $Pool

Get-SCOMAgent

Get-SCOMManagementServer

Get-SCOMResourcePool

Get-SCOMManagementGroupConnection

New-SCOMLocation

Remove-SCOMLocation

Set-SCOMLocation

Update-SCOMLocation