I tried looking at Win32::DriveInfo and that did not have all the information I needed. The Serial Number listed there is volume S/N, not physical S/N. I checked out that other link, but I had NO idea how to implement it in Perl.
I did some digging on WMI in the MSDN and found what I need, but it isn't pretty.
Drive letter info is given at the Win32_LogicalDisk level. The tree from there is as follows:
Win32_LogicalDiskToPartition links to
Win32_DiskPartition, which is referenced by
Win32_DiskDriveToDiskPartition, which links to
Win32_DiskDrive, which is referenced by
Win32_DiskDrivePhysicalMedia, which links to
Win32_PhysicalMedia, which has the actual hardware S/N.
Whew! :) So that ain't gonna be pretty, but all the data is there.
I also saw that newer versions of windows have access to the Win_32_Volume class, which links drive letter to a weird volume string (which looks like a registry entry). However, I could not find how that maps to a physical device, which is the only way, apparently, to get the HW S/N.
Thanks for the help so far. If anyone has any more advice on shortcuts or different approaches, I'm all ears. Until then, I will plug away at this. --Anthony
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.