Share via


New-SCRelationshipInstance

Creates an instance of a relationship.

Syntax

FromRelationshipSouceAndTargetObjects

New-SCRelationshipInstance
    [-RelationshipClass] <ManagementPackRelationship>
    [-Source] <EnterpriseManagementObject>
    [-Target] <EnterpriseManagementObject>
    [-PassThru]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromRelationshipSourceObjectAndTargetClass

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

FromRelationshipSourceClassAndTargetObject

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

FromRelationshipSourceAndTargetClasses

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

Description

The New-SCRelationshipInstance 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-SCRelationshipInstance -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.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:System.Management.Automation.PSCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

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

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RelationshipClass

Specifies the class of the relationship to be created.

Parameter properties

Type:Microsoft.EnterpriseManagement.Configuration.ManagementPackRelationship
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SCSession

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

Parameter properties

Type:

Microsoft.SystemCenter.Core.Connection.Connection[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Source

Specifies the source of the relationship.

Parameter properties

Type:Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromRelationshipSourceObjectAndTargetClass
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromRelationshipSouceAndTargetObjects
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SourceClass

Specifies the class of the source.

Parameter properties

Type:Microsoft.EnterpriseManagement.Configuration.ManagementPackClass
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromRelationshipSourceClassAndTargetObject
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromRelationshipSourceAndTargetClasses
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SourceProperty

Specifies the properties and the values of the source class.

Parameter properties

Type:System.Collections.Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromRelationshipSourceClassAndTargetObject
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromRelationshipSourceAndTargetClasses
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Target

Specifies the target of the relationship.

Parameter properties

Type:Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromRelationshipSouceAndTargetObjects
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromRelationshipSourceClassAndTargetObject
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetClass

Specifies the class of the target of the relationship.

Parameter properties

Type:Microsoft.EnterpriseManagement.Configuration.ManagementPackClass
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromRelationshipSourceObjectAndTargetClass
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromRelationshipSourceAndTargetClasses
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetProperty

Specifies the properties and the values of the target class.

Parameter properties

Type:System.Collections.Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromRelationshipSourceObjectAndTargetClass
Position:4
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromRelationshipSourceAndTargetClasses
Position:4
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.