Hello again Monks, I'm attempting to identify multiple disk drives attached to a Windows 2K3 Server. The following script gives me all the info I require EXCEPT THE DRIVE LETTER (ie: Drive C:). Any help would be much appreciated.
#!C:/Perl/bin/perl.exe -w use strict; use warnings; use Win32::OLE qw(in); my $server = Win32::NodeName(); my $user = ""; my $pwd = ""; my $locatorObj = Win32::OLE->new('WbemScripting.SWbemLocator') || die "Error creating locator object: ".Win32::OLE->LastError()."\n"; $locatorObj->{Security_}->{impersonationlevel} = 3; my $serverObj = $locatorObj->ConnectServer($server,'root\cimv2',$user, +$pwd) || die "Error connecting to $server: ".Win32::OLE->LastError()."\n"; my %disk = (); foreach my $drive (in $serverObj->InstancesOf("Win32_DiskDrive")) { $disk{$drive->{Index}}{DeviceID} = $drive->{DeviceID}; $disk{$drive->{Index}}{Manufacturer} = $drive->{Manufacturer}; $disk{$drive->{Index}}{Model} = $drive->{Model}; $disk{$drive->{Index}}{InterfaceType} = $drive->{InterfaceType}; $disk{$drive->{Index}}{MediaType} = $drive->{MediaType}; $disk{$drive->{Index}}{Partitions} = $drive->{Partitions}; $disk{$drive->{Index}}{Signature} = $drive->{Signature}; $disk{$drive->{Index}}{Size} = $drive->{Size}; } foreach my $dd (sort keys %disk) { if ($disk{$dd}{DeviceID}) { print "DeviceID : ".$disk{$dd}{DeviceID}."\n"; } if ($disk{$dd}{Manufacturer}) { print "Manufacturer : ".$disk{$dd}{Manufacturer}."\n"; } if ($disk{$dd}{Model}) { print "Model : ".$disk{$dd}{Model}."\n"; } if ($disk{$dd}{InterfaceType}) { print "InterfaceType : ".$disk{$dd}{InterfaceType}."\n"; } if ($disk{$dd}{MediaType}) { print "MediaType : ".$disk{$dd}{MediaType}."\n"; } if ($disk{$dd}{Partitions}) { print "Partitions : ".$disk{$dd}{Partitions}."\n"; } if ($disk{$dd}{Signature}) { print "Signature : ".$disk{$dd}{Signature}."\n"; } if ($disk{$dd}{Size}) { print "Size : ".$disk{$dd}{Size}." Bytes.\n"; } print "\n"; }

In reply to Finding the Disk Drive Letter by neo1491

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.