Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Listing and removing mounted shares remotely?

by blm (Hermit)
on Feb 28, 2003 at 13:33 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2023-03-22 15:39 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.