Remove-CIMSession

Remove one or more CIM session objects from the local wps_1 session.

Syntax
      Remove-CimSession [-CimSession] CimSession[] [-Confirm] [-WhatIf] [CommonParameters]
    
      Remove-CimSession [-ComputerName] String[]  [-Confirm] [-WhatIf] [CommonParameters]
    
      Remove-CimSession [-Id] UInt32[]  [-Confirm] [-WhatIf] [CommonParameters]
    
      Remove-CimSession -InstanceId Guid[]  [-Confirm] [-WhatIf] [CommonParameters]
    
      Remove-CimSession -Name String[]  [-Confirm] [-WhatIf] [CommonParameters]

Key
   -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 the New-CimSession or Get-CimSession cmdlets. For more 
       information, see about_CimSessions.

   -ComputerName String[]
       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, using a CIM session gives better performance.

   -Id UInt32[]
       The identifier (ID) ID of the CIM session to remove.
       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 ID of the CIM session to remove.
        
       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[]
       The friendly name of the CIM session to remove. You can use wildcard characters with this parameter.

   -Confirm
       Prompt for confirmation before executing the command.

   -WhatIf
       Describe what would happen if you executed the command without actually executing it.

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

Standard Aliases for Remove-CIMSession: rcms

Examples

Remove all the CIM sessions:

PS C:\> Get-CimSession | Remove-CimSession

Remove a specific CIM session:

PS C:\> Remove-CimSession -Id 64

Show a list of CIM sessions to remove by using the -WhatIf parameter:

PS C:\> Remove-CimSession -Name a* -WhatIf

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

“There is no abstract art. You must always start with something. Afterward you can remove all traces of reality” ~ Pablo Picasso

Related PowerShell Commands:

Get-CimInstance - Get a managed resource (storage, network, software etc.)
New-CimSession - Create a CIM session
New-CimSessionOption - Specify advanced options for New-CimSession.


Copyright © SS64.com 1999-2019
Some rights reserved