PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Remove-CimInstance', 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.


Removes a CIM instance from a computer.


Remove-CimInstance [-InputObject] <CimInstance> [-ComputerName <String[]>] [-OperationTimeoutSec <UInt32>] [-ResourceUri <Uri>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-CimInstance [-InputObject] <CimInstance> [-OperationTimeoutSec <UInt32>] [-ResourceUri <Uri>] -CimSession <CimSession[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-CimInstance [-Query] <String> [[-Namespace] <String>] [-OperationTimeoutSec <UInt32>] [-QueryDialect <String>] -CimSession <CimSession[]> [-Confirm] [-WhatIf]
Remove-CimInstance [-Query] <String> [[-Namespace] <String>] [-ComputerName <String[]>] [-OperationTimeoutSec <UInt32>] [-QueryDialect <String>] [-Confirm] [-WhatIf]

Search powershellhelp.space


The Remove-CimInstance cmdlet removes a CIM instance from a CIM server.

You can specify the CIM instance to remove by using either a CIM instance object retrieved by the Get-CimInstance cmdlet, or by specifying a query.

If the InputObject parameter is not specified, the cmdlet works in one of the following ways:

--If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet works on local Windows Management Instrumentation (WMI) using a Component
Object Model (COM) session.
--If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet works against the CIM server specified by either the ComputerName parameter
or the CimSession parameter.







Example 1: Remove the CIM instance

PS C:\>Remove-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"ꞌ

This command removes the CIM instances that start with the character string testvar from the class named Win32_Environment using the Query parameter.

Example 2: Remove the CIM instance using CIM instance object

PS C:\>calc.exe

PS C:\>$var = Get-CimInstance -Query 'Select * from Win32_Process where name LIKE "calc%"'

PS C:\>Remove-CimInstance –InputObject $var

This set of commands retrieves the CIM instance objects filtered by the Query parameter and stores them in variable named $var using the Get-CimInstance cmdlet. The contents
of the variable are then passed to the Remove-CimInstance cmdlet, which removes the CIM instances.