This is from some code I run - pass in a computer name and get an arrayref back with 
driveletters, free space, and total size. You'll need admin rights on the remote 
machine to run. Hope it's useful!

Paul

sub GetSpace {
        my $computer = shift;
        my @space;
        
        my $WMI = Win32::OLE->GetObject("WinMgmts://$computer") or return undef;
        my $disk = $WMI->InstancesOf("Win32_LogicalDisk");
        
        foreach my $disk (in $disk) {
                next unless $disk->{DriveType} == 3;
                my $size = sprintf("%0.2d",$disk->{Size}/1024/1024);
                my $space = sprintf("%0.2d",$disk->{FreeSpace}/1024/1024);
                my $letter = $disk->{DeviceID};
                push @space, [ $letter, $space, $size ];
        }
        return [EMAIL PROTECTED];
}
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Conrad
Sent: 19 October 2004 15:37
To: [EMAIL PROTECTED]
Subject: How to get remote logical drive letters

Folks,

Is there a way to list the logical fixed disk drive letters on a -remote-
machine?  Requirements would be that all you have for script input is the
machine name, the module would do the work of finding logical fixed disk
letters.  I looked at AdminMisc::GetDrives() and it only seems to list local
drives, similar with Win32::DriveInfo.

Thanks,

Ben
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



*****************************************************************
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.
*****************************************************************


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to