Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Getting Hardware Keys from Windows

by jimbojones (Friar)
on Oct 21, 2004 at 18:54 UTC ( [id://401272]=note: print w/replies, xml ) Need Help??


in reply to Getting Hardware Keys from Windows

If you want the Windows Drive Serial number, the Win32API::File package can do what you want. I'm not sure if it's current or deprecated.

Try
use Win32API::File qw (:Func ); my ( $sRootPath, $osVolName, $lVolName, $ouSerialNum, $ouMaxNameLen, $ +ouFsFlags, $osFsType, $lFsType ); $sRootPath = "C:/"; GetVolumeInformation( $sRootPath, $osVolName, $lVolName, $ouSerialNum, + $ouMaxNameLen, $ouFsFlags, $osFsType, $lFsType ); #---- print "\nRoot:\t$sRootPath\n"; print "VolName:\t$osVolName\n"; print "SerialNumber:\t$ouSerialNum\n"; printf "Hex SerialNumber:\t%x\n", $ouSerialNum;
For me, this returns
Root: C:/ VolName: mecano SerialNumber: 2226596281 Hex SerialNumber: 84b729b9
the stardard 'vol c:' (which you could backtick) returns
>vol c: Volume in drive C is mecano Volume Serial Number is 84B7-29B9
-jim

Update: forgot the 'use' line in the code snippet

Replies are listed 'Best First'.
Re^2: Getting Hardware Keys from Windows
by Anonymous Monk on Oct 27, 2004 at 18:33 UTC
    This gets the VOLUME serial number. Not the manufacturers.
    The volume SN changes every time the disk is partitioned or formatted.

    Is there a Perl module for getting the manufacturers SN?

      Another reason that you may need the manufacturer's Serial Number: it's possible to change the volume serial number via software

      I found this when investigating the above post:

      Changing volume's serial number

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://401272]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found