PowerShell Logo Small

Remove-WmiObject



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

SYNOPSIS

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

SYNTAX


Remove-WmiObject [-Class] <String> [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority
[<String>]] [-ComputerName [<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}]
[-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]]
[-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-ThrottleLimit
[<Int32>]] -Path <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-ThrottleLimit
[<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-ThrottleLimit
[<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-ThrottleLimit
[<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-ThrottleLimit
[<Int32>]] -InputObject <ManagementObject> [-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/p/?linkid=293899
Get-WSManInstance
Invoke-WSManAction
New-WSManInstance
Remove-WSManInstance
Get-WmiObject
Invoke-WmiMethod
Set-WmiInstance

REMARKS

<

Examples


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

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



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 --------------------------

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



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.