Deleting Shares

by May 12, 2009

If you'd like to get rid of a file share, such as the one you created via WMI in our last tip, this is how you can do it:

(Get-WMIObject Win32_Share filter "Name='$sharename'").Delete()

As with share creation, you need admin rights to delete a share.