• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Multiple network share removal. Globally?

I was just going through some stats on our WAN today and noticed that a bunch of people at one of our remote sites have created network shares which is not something we allow.  Is there a way I can remove those shares at once?  I don't want to go though 100+ PC's and remove the shares one by one.  

Then I'll have to put something in place to restrict end-users from creating them but still allow Admins to create shares where/when needed.

Windows 2003 DC's and WinXP SP2 Workstations.

Any ideas?  Thanks guys.
0
wfssupport
Asked:
wfssupport
1 Solution
 
LauraEHunterMVPCommented:
If you can execute scripts remotely against these machines, just run the following script against each machine, replacing <COMPUTERNAME> with a DNS/NetBIOS name or IP address as needed:

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

Set colShares = objWMIService.ExecQuery _
    ("Select * from Win32_Share")

For Each objShare in colShares
    objShare.Delete
Next

0
 
McKnifeCommented:
"End users" already are limited, when it comes to shareing, as long as they are members of the users group. Power users can create shares, users can't.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now