Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Listing and removing mounted shares remotely?

by blm (Hermit)
on Feb 28, 2003 at 13:33 UTC ( [id://239429]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://239429]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found