UPDATE: Taking the excellent comments made, I have been able to come up with the following but when I run it, it accesses the floppy drive every time... I will still need to work on figuring out how to exclude the floppy drive seek unless specifically requested.
use strict; use warnings; use Win32::OLE qw(in); my $objWMIService = Win32::OLE->GetObject("winmgmts:{impersonationLeve +l=impersonate,(security)}//."); die "Error" unless $objWMIService; my $wmiDiskDrives = $objWMIService->ExecQuery("SELECT Caption, DeviceI +D, InterfaceType FROM Win32_DiskDrive"); print "Device Caption -> InterfaceType -> Drive Letter\n"; print "=" x 60 . "\n"; foreach my $wmiDiskDrive ( in( $wmiDiskDrives ) ) { my $deviceID=$wmiDiskDrive->{DeviceId}; $deviceID=~s/\\/\\\\/sg; my $map=qq|ASSOCIATORS OF {Win32_DiskDrive.DeviceID="$deviceID"} W +HERE AssocClass = Win32_DiskDriveToDiskPartition|; #print "$map\n"; my $wmipartitions = $objWMIService->ExecQuery($map); foreach my $wmipartition ( in( $wmipartitions ) ) { my $deviceID=$wmipartition->{DeviceId}; my $map=qq|ASSOCIATORS OF {Win32_DiskPartition.DeviceID="$devi +ceID"} WHERE AssocClass = Win32_LogicalDiskToPartition|; #print "\t$map\n"; my $wmiLogicalDisks = $objWMIService->ExecQuery($map); foreach my $wmiLogicalDisk ( in( $wmiLogicalDisks ) ) { my $drive=$wmiLogicalDisk->{DeviceId}; print join(" -> ", $wmiDiskDrive->{Caption}, $wmiDisk +Drive->{InterfaceType} , $wmiLogicalDisk->{DeviceId}); print "\n"; } } }
-------------------------------
by me
http://www.basgetti.com
http://www.kidlins.com
In reply to Is a drive USB, IDE or SCSI? by slloyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |