| external help file | Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml | |
|---|---|---|
| Locale | en-US | |
| Module Name | CimCmdlets | |
| ms.date | 06/28/2023 | |
| online version | https://learn.microsoft.com/powershell/module/cimcmdlets/remove-cimsession?view=powershell-7.6&WT.mc_id=ps-gethelp | |
| schema | 2.0.0 | |
| aliases |
|
|
| title | Remove-CimSession |
Removes one or more CIM sessions.
Remove-CimSession [-CimSession] <CimSession[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-CimSession [-ComputerName] <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-CimSession [-Id] <UInt32[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-CimSession -InstanceId <Guid[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-CimSession -Name <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
This cmdlet is only available on the Windows platform.
The Remove-CimSession cmdlet removes one or more CIM session objects from the local PowerShell
session.
This example retrieves all the available CIM sessions on the local computer using the
Get-CimSession cmdlet, and then removes them using the Remove-CimSession.
Get-CimSession | Remove-CimSessionThis example removes the CIM session that has an Id value of 5.
Remove-CimSession -Id 5This example uses the common parameter WhatIf to specify that the removal should not be done, but only output what would happen if it were done.
Remove-CimSession -Name a* -WhatIfSpecifies the session objects of the CIM sessions to close.
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.
Type: Microsoft.Management.Infrastructure.CimSession[]
Parameter Sets: CimSessionSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: FalseSpecifies an array of names of computers. Removes the sessions that connect to the specified computers. You can specify a fully qualified domain name (FQDN) or a NetBIOS name.
Type: System.String[]
Parameter Sets: ComputerNameSet
Aliases: CN, ServerName
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: TrueSpecifies the ID of the CIM session to remove. Specify one or more IDs separated by commas, 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 PowerShell session.
For more information about the range operator, see about_Operators.
Type: System.UInt32[]
Parameter Sets: SessionIdSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the instance ID of the CIM session to remove. InstanceId is a Globally Unique Identifier (GUID) that uniquely identifies a CIM session. The InstanceId is unique, even when you have multiple sessions running in PowerShell.
The InstanceId is stored in the InstanceId property of the object that represents a CIM session.
Type: System.Guid[]
Parameter Sets: InstanceIdSet
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the friendly name of the CIM session to remove. You can use wildcard characters with this parameter.
Type: System.String[]
Parameter Sets: NameSet
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: TruePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can't pipe objects to this cmdlet.
This cmdlet returns an object that contains CIM session information.
PowerShell includes the following aliases for Remove-CimSession:
- Windows:
rcms
This cmdlet is only available on Windows platforms.