Get-CIMSession

Get the CIM session objects created in the current wps_1 session.

Syntax
      Get-CimSession [[-ComputerName] String[]] [CommonParameters]

      Get-CimSession [-Id] UInt32[] [CommonParameters]

      Get-CimSession -InstanceId Guid[] [CommonParameters]

      Get-CimSession -Name String[] [CommonParameters]

Key
   -ComputerName String[]
       The name of the computer from which to get CIM sessions. Wildcards are permitted.

   -Id UInt32[]
       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 wps_2 session.
       It is easier to remember and type than InstanceId, but it is unique only within the current wps_2 session.
        
    -InstanceId Guid[]
       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 wps_2.
        
       The InstanceID is stored in the InstanceID property of the object that represents a CIM session.
        
    -Name String[]
       Get one or more CIM sessions which contain the specified friendly names. Wildcard characters are permitted.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer, -PipelineVariable -OutVariable.

Standard Aliases for Get-CIMSession: gcms

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. see about_CimSessions.

Examples

Create a CIM session to multiple computers:

PS C:\> New-CimSession -ComputerName Server64,Server65

Then get the CIM sessions by using Get-CimSession:

PS C:\> Get-CimSession

Get a list of CIM sessions and then format the list in a table:

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

Get all the CIM sessions that have names that begin with the characters serv:

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

Get a specific CIM session:
PS C:\> Get-CimSession -ID 2

“I tell you, when I die I’m not going to have a funeral, I’m going to have a jam session. And, knowing me, I’ll probably get busted at my own funeral. I shall have them playing everything I did musically – everything I enjoyed doing most. The music will be played loud and it will be our music.” ~ Jimi Hendrix

Related PowerShell Commands:

Get-CimInstance - Get a managed resource (storage, network, software etc.)
Invoke-CimMethod - Invoke a method of a CIM class or CIM instance.
New-CimSession - Create a CIM session
New-CimSessionOption - Specify advanced options for New-CimSession.
Remove-CimSession - Remove one or more CIM session objects.


Copyright © SS64.com 1999-2019
Some rights reserved