Remove-WmiObject - PowerShell command help and examples

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


NAME
Remove-WmiObject
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}] [-Authority <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 | Delegate}] [-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}] [-Authority <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 | 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 | Delegate}] [-Locale <string>] [-Namespace <string>] [-AsJob] [-ThrottleLimit <int>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Remove-WmiObject cmdlet deletes an instance of an existing WMI class.
PARAMETERS
-AsJob [<SwitchParameter>] Runs the command as a background job. Use this parameter to run commands that take an extensive time to complete. Runs the command as a background job. Use this parameter to run commands that take a long time to finish. When you use the AsJob parameter, the command returns an object that represents the background job and then displays the command prompt. You can continue to work in the session while the job finishes. If Remove-WmiObject is used against a remote computer, the job is created on the local computer, and the results from remote computers are automatically returned to the local computer. To manage the job, use the cmdlets that contain the Job noun (the Job cmdlets). To get the job results, use the Receive-Job cmdlet. Note: To use this parameter with remote computers, the local and remote computers must be configured for remoting. Additionally, you must start Windows PowerShell by using the "Run as administrator" option in Windows Vista and later versions of Windows,. For more information, see about_Remote_Requirements. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Authentication <AuthenticationLevel> Specifies the authentication level to be used with the WMI connection. Valid values are: -1: Unchanged 0: Default 1: None (No authentication in performed.) 2: Connect (Authentication is performed only when the client establishes a relationship with the application.) 3: Call (Authentication is performed only at the beginning of each call when the application receives the request.) 4: Packet (Authentication is performed on all the data that is received from the client.) 5: PacketIntegrity (All the data that is transferred between the client and the application is authenticated and verified.) 6: PacketPrivacy (The properties of the other authentication levels are used, and all the data is encrypted.) Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Authority <string> Specifies the authority to use to authenticate the WMI connection. You can specify standard NTLM or Kerberos authentication. To use NTLM, set the authority setting to "ntlmdomain:<DomainName>", where <DomainName> identifies a valid NTLM domain name. To use Kerberos, specify "kerberos:<DomainName>\<ServerName>". You cannot include the authority setting when you connect to the local computer. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Class <string> Specifies the name of a WMI class that you want to delete. Required? true Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false -ComputerName <string[]> Specifies the computer against which you want to run the management operation. The value can be a fully qualified domain name, a NetBIOS name, or an IP address. Use the local computer name, use localhost, or use a dot (.) to specify the local computer. The local computer is the default. When the remote computer is in a different domain from the user, you must use a fully qualified domain name. You can set the value of this parameter by piping the value to the parameter. This parameter does not rely on Windows PowerShell remoting, which uses WS-Management ). You can use the ComputerName parameter of Get-WmiObject even if your computer is not configured to run WS-Management remote commands. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Credential <PSCredential> Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Contoso.com". Or, enter a PSCredential object, such as an object that is returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -EnableAllPrivileges [<SwitchParameter>] Enables all the privileges of the current user before the command makes the WMI call. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Impersonation <ImpersonationLevel> Specifies the impersonation level to use. Valid values are: 0: Default (Reads the local registry for the default impersonation level, which is usually set to "3: Impersonate".) 1: Anonymous (Hides the credentials of the caller.) 2: Identify (Allows objects to query the credentials of the caller.) 3: Impersonate (Allows objects to use the credentials of the caller.) 4: Delegate (Allows objects to permit other objects to use the credentials of the caller.) Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -InputObject <ManagementObject> Specifies a ManagementObject object to use as input. When this parameter is used, all other parameters are ignored. Required? true Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? false -Locale <string> Specifies the preferred locale for WMI objects. The Locale parameter is specified as an array in the MS_<LCID> format in the preferred order. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Namespace <string> When used with the Class parameter, this parameter specifies the WMI repository namespace where the referenced WMI class is located. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Path <string> Specifies the WMI object path of a WMI class, or specifies the WMI object path of an instance of a WMI class to delete. Required? true Position? named Default value Accept pipeline input? false Accept wildcard characters? false -ThrottleLimit <int> Allows the user to specify a throttling value for the number of WMI operations that can be executed simultaneously. This parameter is used together with the AsJob parameter. The throttle limit applies only to the current command, not to the session or to the computer. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -Confirm [<SwitchParameter>] Prompts you for confirmation before executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -WhatIf [<SwitchParameter>] Describes what would happen if you executed the command without actually executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".
INPUTS
System.Management.ManagementObject You can pipe a management object to Remove-WmiObject.
OUTPUTS
None or System.Management.Automation.RemotingJob When you use the AsJob parameter, this cmdlet returns a job object. Otherwise, it does not generate any output.
NOTES

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. 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 C:\Windows>powershell get-help Rename-ItemProperty -full

Microsoft Windows [Version 10.0.19045.3693]
Copyright (c) 2023 Microsoft Corporation.

ColorConsole [Version 3.7.1000] PowerShell 2.0-Export

Windows 11, 10, 8.1, 8, 7 / Server 2022, 2019, 2016











Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



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

HTTP: ... PS_Windows/en/Remove-WmiObject.htm
0.061
17937

Pixel color queries with the help of program argument!

Is it possible to close Explorer Tab in 1 click, or duplicate?

Windows Server 2012 and direct download links and trial versions!

Download the Visual Studio 2008 Professional Edition, 90-day trial!

Windows protected your PC on MS Desktops, Server and Mobile?

What are Windows 11, 10, ... etc. Services?



(0)