Get-CimAssociatedInstance

Windows Server 2012 R2 and Windows 8.1

Get-CimAssociatedInstance

Retrieves the CIM instances that are connected to a specific CIM instance by an association.

구문

Parameter Set: ComputerSet
Get-CimAssociatedInstance [-InputObject] <CimInstance> [[-Association] <String> ] [-ComputerName <String[]> ] [-KeyOnly] [-Namespace <String> ] [-OperationTimeoutSec <UInt32> ] [-ResourceUri <Uri> ] [-ResultClassName <String> ] [ <CommonParameters>]

Parameter Set: SessionSet
Get-CimAssociatedInstance [-InputObject] <CimInstance> [[-Association] <String> ] -CimSession <CimSession[]> [-KeyOnly] [-Namespace <String> ] [-OperationTimeoutSec <UInt32> ] [-ResourceUri <Uri> ] [-ResultClassName <String> ] [ <CommonParameters>]




자세한 설명

The Get-CimAssociatedInstance cmdlet retrieves the CIM instances connected to a specific CIM instance, called the source instance, by an association.

In an association, each CIM instance has a named role and the same CIM instance can participate in an association in different roles.

If the InputObject parameter is not specified, the cmdlet works in one of the following ways:

--If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet works on local Windows Management Instrumentation (WMI) using a Component Object Model (COM) session.
--If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet works against the CIM server specified by either the ComputerName parameter or the CimSession parameter.

매개 변수

-Association<String>

Specifies the name of the association class.

If you do not specify this parameter, the cmdlet returns all existing association objects irrespective of their type.

For example, if class A is associated with class B through two associations, AB1 and AB2, then this parameter can be used to specify the type of association, either AB1 or AB2.


별칭

없음

필수 여부

false

위치

2

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-CimSession<CimSession[]>

Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or a command that creates or gets the CIM session, such as New-CimSession or Get-CimSession. For more information, see about_CimSessions.


별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

-ComputerName<String[]>

Specifies the name of the computer on which you want to run the CIM operation. You can specify a fully qualified domain name (FQDN) or a NetBIOS name.

If you specify this parameter, the cmdlet creates a temporary session to the specified computer using the WsMan protocol.

If you do not specify this parameter, the cmdlet performs the operation on the local computer using Component Object Model (COM).

If multiple operations are being performed on the same computer, connecting using a CIM session gives better performance.


별칭

CN,ServerName

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-InputObject<CimInstance>

이 cmdlet에 대한 입력을 지정합니다. 이 매개 변수를 사용하거나 입력을 이 cmdlet으로 파이프할 수 있습니다.


별칭

CimInstance

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

-KeyOnly

Returns objects with only key properties populated.

This reduces the amount of data that is transferred over the network.


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Namespace<String>

Specifies the namespace for the CIM operation.

The default namespace is root/cimv2.
NOTE: You can use tab completion to browse the list of namespaces, because Windows PowerShell gets a list of namespaces from the local WMI server to provide the list of namespaces.


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-OperationTimeoutSec<UInt32>

Specifies the amount of time that the cmdlet waits for a response from the computer.

By default, the value of this parameter is 0, which means that the cmdlet uses the default timeout value for the server.

If the OperationTimeoutSec parameter is set to a value less than the robust connection retry timeout of 3 minutes, network failures that last more than the value of the OperationTimeoutSec parameter are not recoverable, because the operation on the server times out before the client can reconnect.


별칭

OT

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-ResourceUri<Uri>

Specifies the resource uniform resource identifier (URI) of the resource class or instance. The URI is used to identify a specific type of resource, such as disks or processes, on a computer.

A URI consists of a prefix and a path to a resource. For example:

http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk
http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings

By default, if you do not specify this parameter, the DMTF standard resource URI http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/ is used and the class name is appended to it.

ResourceURI can only be used with CIM sessions created using the WSMan protocol, or when specifying the ComputerName parameter, which creates a CIM session using WSMan. If you specify this parameter without specifying the ComputerName parameter, or if you specify a CIM session created using DCOM protocol, you will get an error, because the DCOM protocol does not support the ResourceURI parameter.

If both the ResourceUri parameter and the Filter parameter are specified, the Filter parameter is ignored.


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ResultClassName<String>

Specifies the class name of the associated instances. A CIM instance can be associated with one or more CIM instances. All associated CIM instances are returned if you do not specify the result class name.

By default, the value of this parameter is null, which means all associated CIM instances will be returned.

You can filter the association results to match a specific class name. Filtering happens on the server. If this parameter is not specified, Get-CIMAssociatedInstance returns all existing associations. For example, if class A is associated with classes B, C and D, then this parameter can be used to restrict the output to a specific type (B, C or D).


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(http://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • None

    This cmdlet accepts no input objects.


출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • System.Object

    This cmdlet returns an object.


예제

Example 1: Get all the associated instances of a specific instance

This set of commands retrieves the instances of the class named Win32_LogicalDisk and stores the information in a variable named $disk using the Get-CimInstance cmdlet. The first logical disk instance in the variable is then used as the input object for the Get-CimAssociatedInstance cmdlet to get all the associated CIM instances of the specified CIM instance.


 

PS C:\> $disk = Get-CimInstance -ClassName Win32_LogicalDisk -KeyOnly

 

PS C:\> Get-CimAssociatedInstance -InputObject $disk[1]

Example 2: Get all the associated instances of a specific type

This set of commands retrieves all of the instances of the class named Win32_LogicalDisk and stores them in a variable named $disk. The first logical disk instance in the variable is then used as the input object for the Get-CimAssociatedInstance cmdlet to get all the associated instances that are associated through the specified association class Win32_DiskPartition.


 

PS C:\> $disk = Get-CimInstance -ClassName Win32_LogicalDisk -KeyOnly

 

PS C:\> Get-CimAssociatedInstance -InputObject $disk[1] -ResultClass Win32_DiskPartition

Example 3: Get all the associated instances through qualifier of a specific class

This set of commands retrieves the services that depend on Windows Management Instrumentation (WMI) service and stores them in a variable named $s. The association class name for the Win32_DependentService is retrieved using the Get-CimClass cmdlet by specifying Association as the qualifier and is then passed with $s to the Get-CimAssociatedInstance cmdlet to get all the associated instances of the retrieved association class.


 

PS C:\> $s = Get-CimInstance -Query "Select * from Win32_Service where name like ꞌWinmgmtꞌ"

 

PS C:\> Get-CimClass -ClassName *Service* -Qualifier "Association"

 

PS C:\> $c.CimClasName

 

PS C:\> Get-CimAssociatedInstance -InputObject $s -Association Win32_DependentService

관련 항목

커뮤니티 추가 항목

추가
표시: