Delete a Network Share

Stops sharing a shared folder named FinanceShare. This does not delete the folder from the local hard drive, but simply stops making it available over the network.

VBScript Code

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colShares = objWMIService.ExecQuery _
    ("Select * from Win32_Share Where Name = 'FinanceShare'")

For Each objShare in colShares