Get-SCSMRelationshipInstance

从 Service Manager 获取关系实例。

语法

Get-SCSMRelationshipInstance
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCSMRelationshipInstance
   [-Id] <Guid[]>
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
Get-SCSMRelationshipInstance
   [[-SourceInstance] <EnterpriseManagementObject[]>]
   [[-TargetInstance] <EnterpriseManagementObject[]>]
   [-SCSession <Connection[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential>]
   [<CommonParameters>]

说明

Get-SCSMRelationshipInstance cmdlet 从 Service Manager 检索关系实例。 这些关系描述一个 ClassInstance 到另一个 classInstance的关系。

示例

示例 1:获取类的所有关系实例

PS C:\>$HealthService = Get-SCClassInstance -Class (Get-SCClass -name "Microsoft.SystemCenter.HealthService")
PS C:\>Get-SCSMRelationshipInstance -SourceInstance $HealthService -TargetInstance $HealthService | Format-Table SourceObject,TargetObject -au
SourceObject                  TargetObject
------------                  ------------
WIN-752HJBSX24M.woodgrove.com Software Deployment Workflow Target (internal)
WIN-752HJBSX24M.woodgrove.com Activity Event Workflow Configuration
WIN-752HJBSX24M.woodgrove.com System Center Operations Manager Synchronization Workflow (internal)
WIN-752HJBSX24M.woodgrove.com Grooming Workflow Target (internal)
WIN-752HJBSX24M.woodgrove.com SQL Job Workflow Target
WIN-752HJBSX24M.woodgrove.com Microsoft.ServiceManager.InternalDiscoveryCollectorTarget
WIN-752HJBSX24M.woodgrove.com Release Record Event Workflow Configuration
WIN-752HJBSX24M.woodgrove.com Change Request Event Workflow Configuration
WIN-752HJBSX24M.woodgrove.com Microsoft.EnterpriseManagement.LinkingFramework.OpsMgrConnector.SyncTaskWorkflowTarget
WIN-752HJBSX24M.woodgrove.com Subscription Workflow Target
WIN-752HJBSX24M.woodgrove.com Deployment Workflow Target
WIN-752HJBSX24M.woodgrove.com Change Request Workflow Target
WIN-752HJBSX24M.woodgrove.com Problem Workflow Target
WIN-752HJBSX24M.woodgrove.com mygroup
WIN-752HJBSX24M.woodgrove.com Linking Framework Connector Workflow Target (internal)
WIN-752HJBSX24M.woodgrove.com Microsoft.SystemCenter.MonitoringHostKeepAlive.Workflows.WorkflowTarget
WIN-752HJBSX24M.woodgrove.com Release Record Workflow Target
WIN-752HJBSX24M.woodgrove.com Authoring Workflow Target
WIN-752HJBSX24M.woodgrove.com Incident Event Workflow Configuration
WIN-752HJBSX24M.woodgrove.com Microsoft.SystemCenter.WorkflowFoundation.WorkflowTarget
WIN-752HJBSX24M.woodgrove.com WIN-752HJBSX24M.woodgrove.com
WIN-752HJBSX24M.woodgrove.com Microsoft.ServiceManager.InternalDiscoverySourceTarget
WIN-752HJBSX24M.woodgrove.com Subscriptions Workflow Target
WIN-752HJBSX24M.woodgrove.com Activity Workflow Target
WIN-752HJBSX24M.woodgrove.com WIN-752HJBSX24M.woodgrove.com
WIN-752HJBSX24M.woodgrove.com Desired Configuration Management Event Workflow Configuration
WIN-752HJBSX24M.woodgrove.com Grooming Workflow Target
WIN-752HJBSX24M.woodgrove.com Inbound E-mail Configuration Target (internal)
WIN-752HJBSX24M.woodgrove.com queue1
WIN-752HJBSX24M.woodgrove.com Workflow Target (internal)

这些命令检索源实例和目标实例是 HealthService 类的所有关系实例。

参数

-ComputerName

指定要与之建立连接的计算机。 计算机必须运行 System Center Data Access 服务。 默认值为当前管理组连接的计算机。

有效格式包括 NetBIOS 名称、IP 地址或完全限定的域名(FQDN)。 若要指定本地计算机,请键入计算机名称“localhost”或点(.)。

类型:System.String[]
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-Credential

指定运行管理组连接的用户帐户。 如果指定了服务器,则帐户必须有权访问在 ComputerName 参数中指定的服务器。

默认值为当前用户。 可以输入 Get-Credential cmdlet 返回的 PSCredential 对象。

类型:System.Management.Automation.PSCredential
Position:Named
默认值:Current user context
必需:False
接受管道输入:False
接受通配符:False

-Id

指定要检索的关系对象的 ID。 这可能是 GUID 或将转换为 GUID 的字符串。

类型:System.Guid[]
Position:1
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-SCSession

指定与管理服务器的连接。 默认值为当前管理组连接。

可以输入由 Get-SCManagementGroupConnection cmdlet 返回的管理组连接对象。

类型:Microsoft.SystemCenter.Core.Connection.Connection[]
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-SourceInstance

指定要检索的关系的源类的实例。

类型:Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject[]
Position:1
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-TargetInstance

指定要检索的关系的目标类的实例。

类型:Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject[]
Position:2
默认值:None
必需:False
接受管道输入:False
接受通配符:False

输入

System.Guid

可以通过管道将关系对象的 GUID 传递给 Get-SCSMRelationshipInstance cmdlet 的 Id 参数。

输出

EnterpriseManagementRelationshipObject

此 cmdlet 生成关系对象。