PowerShell Logo Small

Remove-WmiObject



This is the built-in help made by Microsoft for the command 'Remove-WmiObject', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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 <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>]
[-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>]
[-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>] [-Credential
<PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>] [-Credential
<PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>] [-Credential
<PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>] [-ThrottleLimit <Int32>]
-Path <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>] [-Credential
<PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Remove-WmiObject [-AsJob] [-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/?LinkID=113381
Get-WmiObject
Invoke-WmiMethod
Set-WmiInstance
Get-WSManInstance
Invoke-WSManAction
New-WSManInstance
Remove-WSManInstance

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.