From: mayayana on
WMI info. is variable. You really need to download
the help file to get all of your options. But there's
a problem there: There's a file wmisdk.chm, but
Microsoft is no longer making it available. They've
been moving all docs to the main SDK, which now
comes in the newer HTML help format. So you're faced
with a massive download and the need to install
Visual Studio.Net in order to read the help.

You might find wmisdk.chm somewhere, but probably
not in a Microsoft download.

The code you posted is for the box. Many of
the hardware properties return something even
if there's no value. Thus you get "1234567890".
Values returned will also depend on the age of the
BIOS and the source of the PC.

For a more extensive sample, see here:
http://www.jsware.net/jsware/scripts.php5#sysinf

You might find something there you can use, but
don't get your hopes up. For disk drive Device ID
I get the Device Manager string from the Registry.
For motherboard Device ID I get "Motherboard". :)

And since I built the PC myself I get these "helpful"
strings to describe it:

Product Name: System Product Name
Product Version: System Version
Product Description: Computer System Product
IdentifyingNumber: System Serial Number
PC or motherboard model: System Product Name
System Manufacturer: System manufacturer

>
> Hi Duke and others, thanks for the answer.
>
> I have tried WMI for the first time. The following code comes from
> http://msdn.microsoft.com/en-us/library/aa394585%28VS.85%29.aspx
>
> Sub t1()
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" _
> & strComputer & "\root\cimv2")
> Set colSMBIOS = objWMIService.ExecQuery _
> ("Select * from Win32_SystemEnclosure")
> For Each objSMBIOS In colSMBIOS
> Debug.Print "Part Number: " & objSMBIOS.PartNumber
> Debug.Print "Serial Number: " & objSMBIOS.SerialNumber
> Debug.Print "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
> Next
> End Sub
>
> It seems that the code does not give the ouput accurately. Like this :
>
> Part Number:
> Serial Number: Chassis Serial Number
> Asset Tag: Asset -1234567890
>
> I only need to get hard disk,processor and mainboard unique id. Sorry
> for incorrect use of the word HID.
> Could anyone give me the best way ?
>
> John S
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***


From: mayayana on
Found the help file:

http://download.microsoft.com/download/platformsdk/sdkx86/1.5/NT45/EN-US/wmi
sdk.exe

If you have any trouble, or don't want to actually
install the whole SDK, run Universal Extractor and
select the Wise x-shift unpacking option.