PowerShell Logo Small

Get-CimSession



This is the built-in help made by Microsoft for the command 'Get-CimSession', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the CIM session objects from the current session.

SYNTAX


Get-CimSession [[-ComputerName] <String[]>] [<CommonParameters>]
Get-CimSession [-Id] <UInt32[]> [<CommonParameters>]
Get-CimSession -InstanceId <Guid[]> [<CommonParameters>]
Get-CimSession -Name <String[]> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-CimSession cmdlet gets the CIM session objects created in the current wps_1 session.


If used without any parameters, the cmdlet gets all of the CIM sessions created in the current wps_2 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 wps_2 sessions, see about_CimSessions



<

RELATED LINKS

Format-Table
New-CimSession
Remove-CimSession

REMARKS

<

Examples


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

By default, Get-CimSession only gets information about the CIM sessions that exist in the current wps_2 session. Get-CimSession does not get CIM sessions that were created
in other wps_2 sessions or that were created on other computers.
PS C:\> New-CimSession -ComputerName Server01,Server02



PS C:\>
Get-CimSession
Id : 1

Name : CimSession1

InstanceId : d1413bc3-162a-4cb8-9aec-4d2c61253d59

ComputerName : Server01

Protocol : WSMAN


Id : 2



Name : CimSession2



InstanceId : c0095981-52c5-4e7f-a5bb-c4c680541710



ComputerName : Server02



Protocol : WSMAN



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






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

PS C:\>Get-CimSession -ComputerName Server02
Id : 2


Name : CimSession2


InstanceId : c0095981-52c5-4e7f-a5bb-c4c680541710


ComputerName : Server02


Protocol : WSMAN



This command gets the CIM sessions that are connected to the computer named 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

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



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






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

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


Name : CimSession1


InstanceId : d1413bc-162a-4cb8-9aec-4d2c61253d59


ComputerName : Server01


Protocol : WSMAN

Id : 2


Name : CimSession2


InstanceId : c0095981-52c5-4e7f-a5bb-c4c680541710


ComputerName : Server02


Protocol : WSMAN



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






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

PS C:\>Get-CimSession -ID 2



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