--------------------------------------------------------------- # Adapted from VBScript code contained in the book: # "Windows Server Cookbook" by Robbie Allen # ISBN: 0-596-00633-0 # --------------------------------------------------------------- use Win32::OLE qw(in); $Win32::OLE::Warn = 3; $strComputer = '.'; $objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2'); $colDrives = $objWMI->ExecQuery('select * from Win32_MappedLogicalDisk'); print "Mapped Drives:\n"; foreach my $objDrive (in $colDrives) { print ' Device ID: ' . $objDrive->DeviceID, "\n"; print ' Volume Name: ' . $objDrive->VolumeName, "\n"; print ' Session ID: ' . $objDrive->SessionID, "\n"; print ' Size: ' . $objDrive->Size, "\n"; print "\n"; }