use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("SK"); foreach my $computer (@computers) { print "\n"; print "==========================================\n"; print "Computer: $computer\n"; print "==========================================\n"; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Share", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print "AccessMask: $objItem->{AccessMask}\n"; print "AllowMaximum: $objItem->{AllowMaximum}\n"; print "Caption: $objItem->{Caption}\n"; print "Description: $objItem->{Description}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "MaximumAllowed: $objItem->{MaximumAllowed}\n"; print "Name: $objItem->{Name}\n"; print "Path: $objItem->{Path}\n"; print "Status: $objItem->{Status}\n"; print "Type: $objItem->{Type}\n"; print "\n"; } }