Hi, I Am trying to get a map drive percentage of available space in Windows. The Drive name is Y:. The script below works when I changed the drive name to C: but when I use Y,, I receive the following error:
Use of uninitialized value in multiplication (*) at xxxx line 12.
Illegal division by zero at xxxxxx line 13.
Please help and thanks in advance
#!perl
use warnings;
use strict;
use Win32::OLE;
my $fs = Win32::OLE->CreateObject('Scripting.FileSystemObject');
my $d = $fs->GetDrive('Y:');
my $TotalSize = $d->{TotalSize};
my $FreeSpace = $d->{FreeSpace};
my $usedSpace = $d->{TotalSize} -= $d->{FreeSpace};
my $AvailableSpace = $d->{AvailableSpace} *=100;
my $AvailUsed = $AvailableSpace /= $d->{TotalSize};
#my $SpaceLeft = $d->{AvailableSpace} /= $AvailUsed;
my $MappedDriveSpaceAvailable = $AvailUsed *= 100;
print $MappedDriveSpaceAvailable;