Get-SCSMRelationship
Get-SCSMRelationship
Gets information about relationship objects from Service Manager.
Syntax
Parameter Set: Empty
Get-SCSMRelationship [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromManagementPack
Get-SCSMRelationship [-ManagementPack] <ManagementPack[]> [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromRelationshipDisplayName
Get-SCSMRelationship [-DisplayName] <String[]> [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromRelationshipId
Get-SCSMRelationship [-Id] <Guid[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromRelationshipName
Get-SCSMRelationship [-Name] <String[]> [[-Source] <ManagementPackClass[]> ] [[-Target] <ManagementPackClass[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Detailed Description
The Get-SCSMRelationship cmdlet retrieves information about relationship objects from Service Manager.
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 |
-DisplayName<String[]>
Specifies the display name of the relationship object to retrieve.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
true |
-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 |
-ManagementPack<ManagementPack[]>
Specifies one or more management packs containing the relationships to retrieve.
You can enter a ManagementPack object that is returned by the Get-SCManagementPack cmdlet.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Name<String[]>
Specifies the name 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 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 |
-Source<ManagementPackClass[]>
Specifies the classes that represent the source of the relationship. If more than one class is specified, any relationship that has one of those classes as a source is returned. The source class of the relationship must be an exact match of the specified class type.
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 the classes that represent the target of the relationship. If more than one class is specified, any relationship that has one of those classes as a target is returned. The target class of the relationship must be an exact match of the specified class type.
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 pipe a source class to the Source parameter of the Get-SCSMRelationship cmdlet.
Microsoft.EnterpriseManagement.Configuration.ManagementPackClass
You can pipe a target class to the Target parameter of the Get-SCSMRelationship cmdlet.
System.Guid
You can pipe a GUID to the Id parameter of the Get-SCSMRelationship cmdlet.
Microsoft.EnterpriseManagement.Configuration.ManagementPack
You can pipe a management pack to the ManagementPack parameter of the Get-SCSMRelationship cmdlet.
System.String
You can pipe a name to the Name parameter of the Get-SCSMRelationship cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- This cmdlet does not generate any output.
Examples
Example 1: Get information about relationship objects
This command retrieves information about three relationship objects.
PS C:\>Get-SCSMRelationship | Select-Object -first 3
Example 2: Get relationships that target configuration items
Thse commands retrieve relationships that target configuration items.
PS C:\>$x = Get-SCSMClass -name "system.configitem"
PS C:\>Get-SCSMRelationship –Target $x
Example 3: Get relationships that target configuration items and their derived types
These commands retrieve relationships that target configuration items and any types that are derived from these configuration items.
PS C:\>$x = Get-SCClass -name "system.configitem"
PS C:\>$y = @($x; $x.GetDerivedTypes())
PS C:\>Get-SCRelationship –Target $y