Get-CimSession

Windows Server 2012 R2 and Windows 8.1

Get-CimSession

Gets the CIM session objects from the current session.

구문

Parameter Set: ComputerNameSet
Get-CimSession [[-ComputerName] <String[]> ] [ <CommonParameters>]

Parameter Set: InstanceIdSet
Get-CimSession -InstanceId <Guid[]> [ <CommonParameters>]

Parameter Set: NameSet
Get-CimSession -Name <String[]> [ <CommonParameters>]

Parameter Set: SessionIdSet
Get-CimSession [-Id] <UInt32[]> [ <CommonParameters>]




자세한 설명

The Get-CimSession cmdlet gets the CIM session objects created in the current Windows PowerShell® session.

If used without any parameters, the cmdlet gets all of the CIM sessions created in the current Windows PowerShell session. You can use the parameters of Get-CimSession to get the sessions that are for particular computers, or you can identify sessions by their names, IDs, or instance IDs.

For more information about Windows PowerShell sessions, see about_CimSessions

매개 변수

-ComputerName<String[]>

Specifies the name of the computer from which to get CIM sessions. Wildcard characters are permitted.


별칭

cn,ServerName

필수 여부

false

위치

1

기본값

없음

파이프라인 입력 적용 여부

true (ByPropertyName)

와일드카드 문자 허용 여부

true

-Id<UInt32[]>

Specifies the identifier (ID) of the CIM session to get. For one or more IDs, use commas to separate the IDs, or use the range operator (..) to specify a range of IDs.

An ID is an integer that uniquely identifies the CIM session in the current Windows PowerShell session. It is easier to remember and type than InstanceId, but it is unique only within the current Windows PowerShell session.

For more information about the range operator, see about_Operators.


별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

true (ByPropertyName)

와일드카드 문자 허용 여부

false

-InstanceId<Guid[]>

Specifies the instance IDs of the CIM session to get.

InstanceID is a GUID that uniquely identifies a CIM session. The InstanceID is unique, even when you have multiple sessions running in Windows PowerShell.

The InstanceID is stored in the InstanceID property of the object that represents a CIM session.


별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

true (ByPropertyName)

와일드카드 문자 허용 여부

false

-Name<String[]>

Gets one or more CIM sessions which contain the specified friendly names. Wildcard characters are permitted.


별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

true (ByPropertyName)

와일드카드 문자 허용 여부

true

<CommonParameters>

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

입력

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

  • None

출력

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

  • Microsoft.Management.Infrastructure.CimSession

예제

-------------------------- EXAMPLExample 1: Get CIM sessions from the current wps_2 session. --------------------------xample: Get CIM sessions from the current Windows PowerShell session.

This command first creates CIM sessions by using New-CimSession, and then gets the CIM sessions by using Get-CimSession.


 

By default, Get-CimSession only gets information about the CIM sessions that exist in the current Windows PowerShell session. Get-CimSession does not get CIM sessions that were created in other Windows PowerShell sessions or that were created on other computers.


PS C:\> New-CimSession -ComputerName Server01,Server02

 

PS C:\> 
Get-CimSession

-------------------------- EXAMPLE xample 2: Get the CIM sessions from a specific computer --------------------------xample : Get the CIM sessions from a specific computer

This command gets the CIM sessions that are connected to the computer named Server02.


PS C:\> Get-CimSession -ComputerName Server02

-------------------------- EXAMPLE xample 3: Get a list of CIM sessions and then format the list --------------------------xample : Get a list of CIM sessions and then format the list

This command gets all of the CIM sessions in the current Windows PowerShell session, and then formats the list in a table containing only the ComputerName and InstanceID parameters.


 

PS C:\> Get-CimSession | Format-Table -Property ComputerName,InstanceID

-------------------------- EXAMPLExample 4: Get all the CIM sessions that have specific names --------------------------xample: Get all the CIM sessions that have specific names

This command gets all of the CIM sessions that have names that begin with the characters serv.


PS C:\> Get-CimSession -ComputerName Serv*

-------------------------- EXAMPLExample 5: Get a specific CIM session --------------------------xample: Get a specific CIM session

This command gets the CIM session that has an ID of 2.


PS C:\> Get-CimSession -ID 2

관련 항목

커뮤니티 추가 항목

추가
표시: