Remove-SCOMLocation

Remove-SCOMLocation

Removes associations with a location or deletes a location.

Syntax

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

Parameter Set: FromLocation
Remove-SCOMLocation [-Location] <EnterpriseManagementObject[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

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

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

Detailed Description

The Remove-SCOMLocation cmdlet removes the association of a location with an agent-managed computer, management server, or resource pool, or it deletes a location. To remove an association, specify agent-managed computers, management servers, or resource pools. To delete a location, specify the location by using the Get-SCOMLocation cmdlet.

You can change a location display name, a latitude, or a longitude by using the Update-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 (.).

You must run the System Center Data Access service before you use this cmdlet. 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 value is the current user.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Location<EnterpriseManagementObject[]>

Specifies an array of locations as EnterpriseManagementObject objects. To obtain a location, use the Get-SCOMLocation cmdlet.

Aliases

none

Required?

true

Position?

1

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

-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: Delete a location

This example deletes a location that has the display name Seattle, WA. The first command gets the location object that has the display name Seattle, WA, and then stores the object in the $Location variable.

The second command deletes the location object stored in the $Location variable.

PS C:\> $Location = Get-SCOMLocation -DisplayName "Seattle, WA"
PS C:\> Remove-SCOMLocation -Location $Location

Example 2: Remove an agent-managed computer from a location

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

The second command removes the location association from the agent-managed computer object stored in the $Agent variable. This command does not delete the location itself.

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

Example 3: Remove a management server from a location

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

The second command removes the location association from the management server object stored in the $MgmtServer variable. This command does not delete the location itself.

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

Example 4: Remove a resource pool from a location

This example removes a resource pool named Notifications Resource Pool from its location. The first command gets the resource pool object for a resource pool named Notifications Resource Pool, and then stores the object in the $Pool variable.

The second command removes the location association from the resource pool object stored in the $Pool variable. This command does not delete the location itself.

PS C:\> $Pool = Get-SCOMResourcePool –Name "Notifications Resource Pool"
PS C:\> Remove-SCOMLocation -Pool $Pool

Get-SCOMAgent

Get-SCOMManagementServer

Get-SCOMResourcePool

Get-SCOMManagementGroupConnection

Get-SCOMLocation

New-SCOMLocation

Set-SCOMLocation

Update-SCOMLocation

Get-Credential