Get-SCSMRelationshipInstance

Get-SCSMRelationshipInstance

Gets the relationship instances from Service Manager.

Syntax

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

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

Parameter Set: FromRelationshipInstanceSourceTarget
Get-SCSMRelationshipInstance [[-SourceInstance] <EnterpriseManagementObject[]> ] [[-TargetInstance] <EnterpriseManagementObject[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCSMRelationshipInstance cmdlet retrieves the instances of relationships from Service Manager. These relationships describe the relationship of one ClassInstance to another ClassInstance.

Parameters

-ComputerName<String[]>

Specifies a computer with which to establish a connection. The computer must be running the System Center Data Access service. The default value is the computer for the current management group connection.

Valid formats include a NetBIOS name, an IP address, or a fully qualified domain name (FQDN). 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?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies a user account under which the management group connection will run. The account must have access to the server that is specified in the ComputerName parameter, if the server is specified.

The default value is the current user. You can enter a PSCredential object that is returned by the Get-Credential cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

Current user context

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Id<Guid[]>

Specifies the ID 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

-SCSession<Connection[]>

Specifies a connection to a management server. The default value is the current management group connection.

You can enter a management group connection object that is returned by the Get-SCManagementGroupConnection cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SourceInstance<EnterpriseManagementObject[]>

Specifies the instances that represent the source class of the relationships to be retrieved.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-TargetInstance<EnterpriseManagementObject[]>

Specifies the instances that represent the target class of the relationships to be retrieved.

Aliases

none

Required?

false

Position?

2

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.

  • System.Guid

    You can pipe a GUID of a relationship object to the Id parameter of the Get-SCSMRelationshipInstance 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 for a class

These commands retrieve all relationship instances for which the source instance and the target instance is the HealthService class.

PS C:\>$HealthService = Get-SCClassInstance -Class (Get-SCClass -name "Microsoft.SystemCenter.HealthService") 
PS C:\>Get-SCSMRelationshipInstance -SourceInstance $HealthService -TargetInstance $HealthService | Format-Table SourceObject,TargetObject -au

Service Manager Administrator Cmdlets Group 1