Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Getting Hardware Keys from Windows

by jimbojones (Friar)
on Oct 27, 2004 at 22:49 UTC ( [id://403173]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Getting Hardware Keys from Windows
in thread Getting Hardware Keys from Windows

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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-23 09:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found