Display shares on a system (Perl)

This code can be found in Chapter 8 of Windows XP Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the Perl code from this site.

# From the book "Windows XP Cookbook"
# ISBN: 0596007256

# ------ SCRIPT CONFIGURATION ------

use Win32::OLE qw(in);

$strComputer = '.';
# ------ END CONFIGURATION ---------
$objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');
$colShares = $objWMI->InstancesOf('Win32_Share');
foreach my $objShare (in $colShares) {
    print $objShare->Name, "\n";
    print ' Path: ' . $objShare->Path, "\n";
    print ' Allow Max: ' . $objShare->AllowMaximum, "\n";
    print ' Caption: ' . $objShare->Caption, "\n";
    print ' Max Allowed: ' . $objShare->MaximumAllowed, "\n";
    print ' Type: ' . $objShare->Type, "\n";
    print "\n";
}

This code has been viewed 674 times.

New from the creators of TechTasks.com: StatSheet.com