Alright, then

Try

use Win32::OLE qw( in); #-- get an object reference to the manager my $local_computer = "."; my $mgmr = Win32::OLE->GetObject("winmgmts://./root/cimv2"); print "A sample of methods from\n"; print "\t'http://msdn.microsoft.com/library/default.asp?url=/library/e +n-us/wmisdk/wmi/win32_diskdrive.asp'\n"; print "\n"; foreach my $objDisk (in $mgmr->InstancesOf("Win32_DiskDrive")) { print "Availability\t", $objDisk->Availability, "\n"; print "Bytes per Sector\t", $objDisk->BytesPerSector, "\n"; print "Caption\t", $objDisk->Caption, "\n"; print "Compression Method\t", $objDisk->CompressionMethod, "\n"; print "Creation Class Name\t", $objDisk->CreationClassName, "\n" +; print "Default Block Size\t", $objDisk->DefaultBlockSize, "\n"; print "Description\t", $objDisk->Description, "\n"; print "Device ID\t", $objDisk->DeviceID, "\n"; print "Install Date\t", $objDisk->InstallDate, "\n"; print "Manufacturer\t", $objDisk->Manufacturer, "\n"; print "Media Type\t", $objDisk->MediaType, "\n"; print "Model\t", $objDisk->Model, "\n"; print "Name\t", $objDisk->Name, "\n"; print "Needs Cleaning\t", $objDisk->NeedsCleaning, "\n"; print "Partitions\t", $objDisk->Partitions, "\n"; print "PnP Device ID\t", $objDisk->PNPDeviceID, "\n"; print "Signature\t", $objDisk->Signature, "\n"; print "Size\t", $objDisk->Size, "\n"; print "System Name\t", $objDisk->SystemName, "\n"; print "\n"; } print "A sample of methods from\n"; print "\t'http://msdn.microsoft.com/library/default.asp?url=/library/e +n-us/wmisdk/wmi/win32_physicalmedia.asp'\n"; print "\n"; foreach my $objDisk (in $mgmr->InstancesOf("Win32_PhysicalMedia")) { print "Capacity\t", $objDisk->Capacity, "\n"; print "Caption\t", $objDisk->Caption, "\n"; print "Creation Class\t", $objDisk->CreationClassName, "\n"; print "Description\t", $objDisk->Description, "\n"; print "Manufacturer\t", $objDisk->Manufacturer, "\n"; print "Media Description\t", $objDisk->MediaDescription, "\n"; print "Media Type\t", $objDisk->MediaType, "\n"; print "Model\t", $objDisk->Model, "\n"; print "Name\t", $objDisk->Name, "\n"; print "Other ID Info\t", $objDisk->OtherIdentifyingInfo, "\n"; print "Part Number\t", $objDisk->PartNumber, "\n"; print "Serial Number\t", $objDisk->SerialNumber, "\n"; print "SKU\t", $objDisk->SKU, "\n"; print "Status\t", $objDisk->Status, "\n"; print "Write Protect\t", $objDisk->WriteProtectOn, "\n"; print "\n"; }
This C# Code claims that the DiskDrive and PhysicalMedia occur in order, so that the serial number in the latter can be related to the drive in the former. In my case, it didn't matter as I had only the one disk drive. However, if you have more than one, that's what the foreach/in is for.

For a complete list of the methods, see:

Hope this gets you further to what you want

-jim

Update link was to C# code, not VB code.

In reply to Re^3: Getting Hardware Keys from Windows by jimbojones
in thread Getting Hardware Keys from Windows by PerlingTheUK

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.