New-SCSMRelationshipInstance

Creates an instance of a relationship.

Syntax

New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship>
 [-Source] <EnterpriseManagementObject> [-TargetClass] <ManagementPackClass> [-TargetProperty] <Hashtable>
 [-ComputerName <String[]>] [-Credential <PSCredential>] [-PassThru] [-SCSession <Connection[]>]
 [<CommonParameters>]
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship>
 [-Source] <EnterpriseManagementObject> [-Target] <EnterpriseManagementObject> [-ComputerName <String[]>]
 [-Credential <PSCredential>] [-PassThru] [-SCSession <Connection[]>] [<CommonParameters>]
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship>
 [-SourceClass] <ManagementPackClass> [-SourceProperty] <Hashtable> [-Target] <EnterpriseManagementObject>
 [-ComputerName <String[]>] [-Credential <PSCredential>] [-PassThru] [-SCSession <Connection[]>]
 [<CommonParameters>]
New-SCSMRelationshipInstance [-RelationshipClass] <ManagementPackRelationship>
 [-SourceClass] <ManagementPackClass> [-SourceProperty] <Hashtable> [-TargetClass] <ManagementPackClass>
 [-TargetProperty] <Hashtable> [-ComputerName <String[]>] [-Credential <PSCredential>] [-PassThru]
 [-SCSession <Connection[]>] [<CommonParameters>]

Description

The New-SCSMRelationshipInstance cmdlet creates an instance of a relationship.

Examples

Example 1: Create a relationship instance

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-SCSMRelationshipInstance -RelationshipClass $Rel -Source $Computers[0] -Target $Computers[1]

These commands create an instance of a relationship.

Parameters

-ComputerName

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.

Type:String[]
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Credential

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.

Type:PSCredential
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PassThru

Specifies the output object that represents the new relationship. This output object can be passed to other cmdlets.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RelationshipClass

Specifies the class of the relationship to be created.

Type:ManagementPackRelationship
Required:True
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SCSession

Specifies an object that represents the session to a Service Manager management server.

Type:Connection[]
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Source

Specifies the source of the relationship.

Type:EnterpriseManagementObject
Required:True
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SourceClass

Specifies the class of the source.

Type:ManagementPackClass
Required:True
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SourceProperty

Specifies the properties and the values of the source class.

Type:Hashtable
Required:True
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Target

Specifies the target of the relationship.

Type:EnterpriseManagementObject
Required:True
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetClass

Specifies the class of the target of the relationship.

Type:ManagementPackClass
Required:True
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetProperty

Specifies the properties and the values of the target class.

Type:Hashtable
Required:True
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False