PowerShell Logo Small

Remove-WmiObject



This is the built-in help made by Microsoft for the command 'Remove-WmiObject', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' 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

Deletes an instance of an existing Windows Management Instrumentation (WMI) class.

SYNTAX


Remove-WmiObject [-Class] <string> [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-A
uthority <string>] [-ComputerName <string[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify
| Impersonate | Delegate}] [-Locale <string>] [-Namespace <string>] [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority <string>]
[-ComputerName <string[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | D
elegate}] [-Locale <string>] [-Namespace <string>] [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject -InputObject <ManagementObject> [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject -Path <string> [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Auth
ority <string>] [-ComputerName <string[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify |
Impersonate | Delegate}] [-Locale <string>] [-Namespace <string>] [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority <string>]
[-ComputerName <string[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | D
elegate}] [-Locale <string>] [-Namespace <string>] [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority <string>]
[-ComputerName <string[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | D
elegate}] [-Locale <string>] [-Namespace <string>] [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Remove-WmiObject cmdlet deletes an instance of an existing WMI class.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113381
Get-WmiObject
Invoke-WmiMethod
Set-WmiInstance
Get-WSManInstance
Invoke-WSManAction
New-WSManInstance
Remove-WSManInstance

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>notepad
C:\PS> $np = get-wmiobject -query "select * from win32_process where name='notepad.exe'"
C:\PS> $np | remove-wmiobject



Description
-----------
This command closes all the instances of Notepad.exe.

The first command starts an instance of Notepad.

The second command uses the Get-WmiObject cmdlet to retrieve the instances of the Win32_Process that correspond to Notepad.exe and stores them in
the $np variable.

The third command passes the object in the $np variable to the Remove-WmiObject cmdlet, which deletes all the instances of Notepad.exe.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>$a = Get-WMIObject -query "Select * From Win32_Directory Where Name ='C:\\Test'"
C:\PS> $a | Remove-WMIObject



Description
-----------
This command deletes the C:\Test directory.

The first command uses the Get-WMIObject cmdlet to query for the C:\Test directory and then stores the object in the $a variable.

The second command pipes the $a variable to the Remove-WMIObject, which deletes the directory.