Remove-WmiObject

Having shown how a new WMI object can be created using Invoke-WmiMethod we need to consider how to remove a WMI Object.  CTP 2 supplies a Remove-WMIObject cmdlet.  This takes a WMI path to identify the individual object or you can use Get-WMIObject to identify object and pipe the result to Remove-WMIObject

Get-WmiObject -Class Win32_process -Filter "Name='notepad.exe'" | Remove-WmiObject

Remove-WMIObject does not support the -whatif and -confirm parameters so best practice is to use get-wmiobject and the filter capability to identify the correct object before piping to Remove-WMIObject

 

Share this post :

 

Technorati Tags: ,

Read the complete post at http://richardsiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!1544.entry

Published Tue, Jul 15 2008 16:19 by Richard Siddaway's Blog
Filed under: