Novice Monk has asked for the wisdom of the Perl Monks concerning the following question:

Does anybody know a quick solution to identify shares on a remote Win32 machine?

I've discovered that a number of machines on my domain give 'Everyone' full access to their shares.
This is a search-and-destroy mission!

Replies are listed 'Best First'.
Re: Shared directories on remote Win32
by AcidHawk (Vicar) on Apr 15, 2003 at 10:26 UTC

    A VERY quick look lead me to Win32::NetResource with the GetSharedResources function. The following is from the docs.

    # # This example displays all the share points in the entire # visible part of the network. # use strict; use Win32::NetResource qw(:DEFAULT GetSharedResources GetError); my $resources = []; unless(GetSharedResources($resources, RESOURCETYPE_ANY)) { my $err; GetError($err); warn Win32::FormatMessage($err); } foreach my $href (@$resources) { next if ($$href{DisplayType} != RESOURCEDISPLAYTYPE_SHARE); print "-----\n"; foreach( keys %$href){ print "$_: $href->{$_}\n"; } }

    Update: Fixed link to cpan docs.

    -----
    Of all the things I've lost in my life, its my mind I miss the most.