in reply to Listing and removing mounted shares remotely?

I have been using the IADsFileShare interface to create shares at work. After reading your question I decided to read up on it to see whether it was appropriate for deleting shares remotely instead. This says that it can represent shares remotely and here I found the code to do delete shares using this interface written in vbscript. I simply translated it to perl and tested it locally under Windows 2000. Unfortunately I only have one Windows machine so I can't test it remotely. It uses ADSI which I think you need to download and install in on NT4 but is already there under Windows 2000. I don't know about Win 9x. You didn't say what OS you were using.

Here is my perl translation

use Win32::OLE; my $share_name = "dev"; my $machine_name = "FIREBALL"; my $server = Win32::OLE->GetObject("WinNT://FIREBALL/lanmanserver") or die $!; $server->Delete("Fileshare", $share_name)

Note that this interface has a CurrentUserCount property that could tell you how many people are using the share.

Please let me know how it goes!