New-SCSMRelationshipInstance
New-SCSMRelationshipInstance
Creates an instance of a relationship.
Syntax
Parameter Set: FromRelationshipSouceAndTargetObjects
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship> [-Source] <EnterpriseManagementObject> [-Target] <EnterpriseManagementObject> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromRelationshipSourceAndTargetClasses
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship> [-SourceClass] <ManagementPackClass> [-SourceProperty] <Hashtable> [-TargetClass] <ManagementPackClass> [-TargetProperty] <Hashtable> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromRelationshipSourceClassAndTargetObject
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship> [-SourceClass] <ManagementPackClass> [-SourceProperty] <Hashtable> [-Target] <EnterpriseManagementObject> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromRelationshipSourceObjectAndTargetClass
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship> [-Source] <EnterpriseManagementObject> [-TargetClass] <ManagementPackClass> [-TargetProperty] <Hashtable> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [ <CommonParameters>]
Detailed Description
The New-SCSMRelationshipInstance cmdlet creates an instance of a relationship.
Parameters
-ComputerName<String[]>
Specifies the name of the computer on which the System Center Data Access service is running. The user account that is specified in the Credential parameter must have access rights to the specified computer.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Credential<PSCredential>
Specifies the credentials to be used when you are connecting to the server on which the System Center Data Access service is running. The specified user account must have access rights to that server.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-PassThru
Specifies the output object that represents the new relationship. This output object can be passed to other cmdlets.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RelationshipClass<ManagementPackRelationship>
Specifies the class of the relationship to be created.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-SCSession<Connection[]>
Specifies an object that represents the session to a Service Manager management server.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Source<EnterpriseManagementObject>
Specifies the source of the relationship.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true (ByPropertyName) |
Accept Wildcard Characters? |
false |
-SourceClass<ManagementPackClass>
Specifies the class of the source.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-SourceProperty<Hashtable>
Specifies the properties and the values of the source class.
Aliases |
none |
Required? |
true |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-Target<EnterpriseManagementObject>
Specifies the target of the relationship.
Aliases |
none |
Required? |
true |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-TargetClass<ManagementPackClass>
Specifies the class of the target of the relationship.
Aliases |
none |
Required? |
true |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-TargetProperty<Hashtable>
Specifies the properties and the values of the target class.
Aliases |
none |
Required? |
true |
Position? |
4 |
Default Value |
none |
Accept Pipeline Input? |
true (ByPropertyName) |
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: Create a relationship instance
These commands create an instance of a relationship.
PS C:\>$Rel = Get-SCRelationship -Name "System.ConfigItemRelatesToConfigItem"
PS C:\>$Mwc = Get-SCClass -Name "Microsoft.Windows.Computer"
PS C:\>$Computers = Get-SCClassInstance -Class $Mwc
PS C:\>New-SCRelationshipInstance -RelationshipClass $Rel -Source $Computers[0] -Target $Computers[1]