in reply to (code) Win32 disk monitor, email notify, event log

my @drives=Win32::AdminMisc::GetDrives(DRIVE_FIXED);

If you have any SUBSTed 'drives', GetDrives() will list those as if they were additional drives, which may or may not be what you want (I imagine it'd matter more if you had seperate alarms for each drive).

I'm not familiar with Win32::AdminMisc, but I got around this using Win32::DriveInfo's VolumeInfo...

foreach my $drive ( Win32::DriveInfo::DrivesInUse ) { next unless Win32::DriveInfo::DriveType($drive) == FIXED_DISK; my $serial = (Win32::DriveInfo::VolumeInfo($drive))[1]; next if $seen{$serial}++; }

Also, what happens if you have 0 bytes free? Won't the below cause your script to skip over it? (Forgive my ignorance if GetDriveSpace() returns some sort of '0 but true' string instead...)

  if($total && $free){