New-SCSMRelationshipInstance

Creates an instance of a relationship.

Syntax

New-SCSMRelationshipInstance
   [-RelationshipClass] <ManagementPackRelationship>
   [-Source] <EnterpriseManagementObject>
   [-TargetClass] <ManagementPackClass>
   [-TargetProperty] <Hashtable>
   [-PassThru]
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
New-SCSMRelationshipInstance
   [-RelationshipClass] <ManagementPackRelationship>
   [-Source] <EnterpriseManagementObject>
   [-Target] <EnterpriseManagementObject>
   [-PassThru]
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
New-SCSMRelationshipInstance
   [-RelationshipClass] <ManagementPackRelationship>
   [-Target] <EnterpriseManagementObject>
   [-SourceClass] <ManagementPackClass>
   [-SourceProperty] <Hashtable>
   [-PassThru]
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
New-SCSMRelationshipInstance
   [-RelationshipClass] <ManagementPackRelationship>
   [-SourceClass] <ManagementPackClass>
   [-SourceProperty] <Hashtable>
   [-TargetClass] <ManagementPackClass>
   [-TargetProperty] <Hashtable>
   [-PassThru]
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<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[]
Position:Named
Default value:None
Required:False
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
Position:Named
Default value:None
Required:False
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
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RelationshipClass

Specifies the class of the relationship to be created.

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

-SCSession

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

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

-Source

Specifies the source of the relationship.

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

-SourceClass

Specifies the class of the source.

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

-SourceProperty

Specifies the properties and the values of the source class.

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

-Target

Specifies the target of the relationship.

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

-TargetClass

Specifies the class of the target of the relationship.

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

-TargetProperty

Specifies the properties and the values of the target class.

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