Get-SCOMRelationship

Get-SCOMRelationship

Retrieves information about relationship objects from Operations Manager.

Syntax

Parameter Set: Empty
Get-SCOMRelationship [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [ <CommonParameters>]

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

Parameter Set: FromManagementPack
Get-SCOMRelationship [-ManagementPack] <ManagementPack[]> [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [ <CommonParameters>]

Parameter Set: FromRelationshipDisplayName
Get-SCOMRelationship [-DisplayName] <String[]> [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [ <CommonParameters>]

Parameter Set: FromRelationshipId
Get-SCOMRelationship [-Id] <Guid[]> [ <CommonParameters>]

Parameter Set: FromRelationshipName
Get-SCOMRelationship [-Name] <String[]> [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCOMRelationship cmdlet retrieves information about relationship objects from System Center 2012 – Operations Manager.

Parameters

-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 (.).

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

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

Current user context

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DisplayName<String[]>

Specifies an array of display names of the relationship object to retrieve.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

true

-Id<Guid[]>

Specifies an array of GUIDs of the relationship object to retrieve. This may be a GUID or a string that will be converted to a GUID.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ManagementPack<ManagementPack[]>

Specifies an array of management packs containing the relationships to retrieve. To obtain a ManagementPack object, use the Get-SCOMManagementPack cmdlet.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String[]>

Specifies an array of names of the relationship object to retrieve.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

true

-SCSession<Connection[]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Source<ManagementPackClass[]>

Specifies an array of classes that represent the source of the relationship. If you specify more than one class, the cmdlet returns any relationship that includes one of those classes as a source. The source class of the relationship must match the specified class type. To obtain a ManagementPackClass object, use the Get-SCOMClass cmdlet.

If you specify classes for both the Target and the Source parameters, the cmdlet returns all relationships in which the target class is one of the specified target classes and the source class is one of the specified source classes.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Target<ManagementPackClass[]>

Specifies an array of classes that represent the target of the relationship. If you specify more than one class, the cmdlet returns any relationship that includes one of those classes as a target. The target class of the relationship must match the specified class type. To obtain a ManagementPackClass object, use the Get-SCOMClass cmdlet.

If you specify classes for both the Target and the Source parameters, the cmdlet returns all relationships in which the target class is one of the specified target classes and the source class is one of the specified source classes.

Aliases

none

Required?

false

Position?

3

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.

  • Microsoft.EnterpriseManagement.Configuration.ManagementPackClass

    You can pass a source class to the Source parameter of the Get-SCOMRelationship cmdlet by using the pipeline operator.

  • Microsoft.EnterpriseManagement.Configuration.ManagementPackClass

    You can pass a target class to the Target parameter of the Get-SCOMRelationship cmdlet by using the pipeline operator.

  • System.Guid

    You can pass a GUID to the Id parameter of the Get-SCOMRelationship cmdlet by using the pipeline operator.

  • Microsoft.EnterpriseManagement.Configuration.ManagementPack

    You can pass a management pack to the ManagementPack parameter of the Get-SCOMRelationship cmdlet by using the pipeline operator.

  • System.String

    You can pipe a name to the Name parameter of the Get-SCOMRelationship cmdlet by using the pipeline operator.

Outputs

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

  • This cmdlet does not generate any output.

Examples

Example 1: Retrieve relationship information

This command retrieves information about the first three relationship objects.

PS C:\> Get-SCOMRelationship | Select-Object -first 3

Example 2: Retrieve relationship information for configuration items

This example retrieves relationships that target configuration items.

The first command uses the Get-SCOMClass cmdlet to retrieve the class for an item by name, and stores the result in the variable named X.

The second command uses the Get-SCOMRelationship cmdlet to get the relationship.

PS C:\> $X = Get-SCOMClass -Name "system.configitem"
PS C:\> Get-SCOMRelationship –Target $X

Example 3: Retrieve relationship information for derived types

This example retrieves relationships that target configuration items, as well as any types that derive from these configuration items.

The first command uses the Get-SCOMClass cmdlet to retrieve the class for an item by name, and stores the result in the variable named X.

The second command uses the GetDerivedTypes method and stores the result in the variable named Y.

The third command uses the Get-SCOMRelationship cmdlet to get the relationship for the derived types.

PS C:\> $X = Get-SCOMClass -Name "system.configitem"
PS C:\> $Y = @($X; $X.GetDerivedTypes())
PS C:\> Get-SCOMRelationship –Target $Y


Get-SCOMClass

Get-SCOMManagementPack