slloyd has asked for the wisdom of the Perl Monks concerning the following question:
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|; my $wmipartitions = $objWMIService->ExecQuery($map); foreach my $wmipartition ( in( $wmipartitions ) ) { my $deviceID=$wmipartition->{DeviceId}; print "$deviceID\n"; my $map=qq|ASSOCIATORS OF {Win32_DiskPartition.DeviceID="$devi +ceID"} WHERE AssocClass = Win32_LogicalDiskToPartition|; 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Floppy Drive Problems
by NetWallah (Canon) on Dec 04, 2005 at 08:20 UTC | |
by slloyd (Hermit) on Dec 05, 2005 at 05:30 UTC | |
by NetWallah (Canon) on Dec 05, 2005 at 06:58 UTC | |
by slloyd (Hermit) on Dec 06, 2005 at 03:08 UTC | |
by slloyd (Hermit) on Dec 06, 2005 at 14:14 UTC |