in reply to Is a drive USB, IDE or SCSI?
use strict; use warnings; use Win32::OLE qw(in); my $objWMIService = Win32::OLE->GetObject("winmgmts:{impersonationLeve +l=impersonate,(security)}//."); die "Error" unless $objWMIService; my $colDisks = $objWMIService->ExecQuery("Select * from Win32_DiskDriv +e"); print "Device Caption -> InterfaceType -> DeviceId\n"; print "=" x 60 . "\n"; foreach my $obj ( in( $colDisks ) ) { print join(" -> ", $obj->{Caption}, $obj->{InterfaceType} , $obj-> +{DeviceId}); print "\n"; }
On my machine, it produces the following:
Device Caption -> InterfaceType -> DeviceId ============================================================ WDC WD400BB-00CLB0 -> IDE -> \\.\PHYSICALDRIVE0 WDC WD800JB-00JJA0 -> IDE -> \\.\PHYSICALDRIVE1
Update: minor edit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is a drive USB, IDE or SCSI?
by slloyd (Hermit) on Dec 03, 2005 at 15:01 UTC | |
by psychotic (Beadle) on Dec 03, 2005 at 15:22 UTC | |
by slloyd (Hermit) on Dec 03, 2005 at 15:33 UTC |