Get-SCOMRelationshipInstance

Get-SCOMRelationshipInstance

Retrieves the instances of relationships from Operations Manager.

Syntax

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

Parameter Set: FromRelationshipInstanceId
Get-SCOMRelationshipInstance [-Id] <Guid[]> [ <CommonParameters>]

Parameter Set: FromRelationshipInstanceSourceTarget
Get-SCOMRelationshipInstance [[-SourceInstance] <EnterpriseManagementObject[]> ] [[-TargetInstance] <EnterpriseManagementObject[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCOMRelationshipInstance cmdlet retrieves the instances of relationships from System Center 2012 – Operations Manager. These relationships describe the relationship of one class instance to another class instance.

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

-Id<Guid[]>

Specifies an array of GUIDs of the relationship object that this cmdlet gets. 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

-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?

false

Accept Wildcard Characters?

false

-SourceInstance<EnterpriseManagementObject[]>

Specifies an array of instances that represent the source class of the relationships that this cmdlet gets. To obtain a class instance object, use the Get-SCOMClassInstance cmdlet. For more information type Get-Help Get-SCOMClassInstance.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-TargetInstance<EnterpriseManagementObject[]>

Specifies an array of instances that represent the target class of the relationships that this cmdlet gets.

Aliases

none

Required?

false

Position?

2

Default Value

none

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.

  • System.Guid

    You can pipe a GUID of a relationship object to the Id parameter of the Get-SCOMRelationshipInstance cmdlet.

Outputs

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

  • EnterpriseManagementRelationshipObject

    This cmdlet generates a relationship object.

Examples

Example 1: Get all relationship instances

This example gets all relationship instances for which the source instance and the target instance are the Health Service class.

The first command uses the Get-SCOMClassInstance cmdlet to get the class instance. The output of the command in parentheses becomes input to the Class parameter. The cmdlet stores the result in the variable named HealthService.

The second command uses the Get-SCOMRelationshipInstance cmdlet to retrieve the relationship instance with the variable named HealthService.

PS C:\> $HealthService = Get-SCOMClassInstance -Class (Get-SCOMClass -Name Microsoft.SystemCenter.HealthService)
PS C:\> Get-SCOMRelationshipInstance -SourceInstance $HealthService -TargetInstance $HealthService | format-Table

Get-SCOMClassInstance

Get-SCOMManagementGroupConnection

Get-Credential