There is a CLI tool in the Windows SDK called computerhardwareids
The tool returns various GUIDs to select the appropriate HardwareId for a particular case.
This is the result that this tool returns on my PC:
Using the BIOS to gather information
Computer Information
BIOS Vendor: American Megatrends Inc.
BIOS Version string: 1201
System BIOS Major Release: 4
System BIOS Minor Release: 6
System Manufacturer: To be filled by O.E.M.
System Family: To be filled by O.E.M.
System ProductName: To be filled by O.E.M.
SKU Number: SKU
Enclosure Type: 03 "Desktop"
Hardware IDs
{a8670b03-1d98-5e95-ad4e-c64211eac9df} <- Manufacturer + Family + ProductName + SKUNumber + BIOS Vendor + BIOS Version + BIOS Major Release + BIOS Minor Release
{01c6b2a2-a2b2-58e4-906d-4677639f1a42} <- Manufacturer + Family + ProductName + BIOS Vendor + BIOS Version + BIOS Major Release + BIOS Minor Release
{dc5af3fe-c2de-539d-aafd-5061a1634723} <- Manufacturer + ProductName + BIOS Vendor + BIOS Version + BIOS Major Release + BIOS Minor Release
{d78b474d-dee0-5412-bc9d-e9f7d7783df2} <- Manufacturer + Family + ProductName + SKUNumber
{7ccbb6f1-9641-5f84-b00d-51ff218a4066} <- Manufacturer + Family + ProductName
{5a127cba-be28-5d3b-84f0-0e450d266d97} <- Manufacturer + SKUNumber
{6525c6e5-28e9-5f9c-abe4-20fd82504002} <- Manufacturer + ProductName
{6525c6e5-28e9-5f9c-abe4-20fd82504002} <- Manufacturer + Family
{482f3f58-6045-593a-9be4-611717ce4770} <- Manufacturer + Enclosure Type
{11b4a036-3b64-5421-a372-22c07df10a4d} <- Manufacturer
I would like to develop a universal use function that should mimic the functionality of this Microsoft tool, returning exactly the same HardwareIds (exactly the same).
I found information about MSDN, all the output looks very documented and contains information about the values returned by this tool, but it does not indicate exactly what the properties of the WMI classes are, it just says "Bios" and "system":
Overview of ComputerHardwareIds
, , "", " BIOS", " Bios", "Bios Minor Release", , " SKU", .
, WMI, , guid:
Win32_BIOS
Win32_BaseBoard
Win32_ComputerSystem
Win32_ComputerSystemProduct
, :
GUID SHA-1 .
, , , - , , Guis ( ):
Private Function GetHardwareId() As Guid
Dim HardwareId As String = String.Empty
Dim BIOSVersion, BIOSVendor, BIOSMajorRelease, BIOSMinorRelease,
SystemManufacturer, SystemFamily, SystemProductName, SKUNumber As String
' Get System Info.
Using wmi As New Management.ManagementObjectSearcher("select * from Win32_ComputerSystem")
Using SystemInfo As Management.ManagementObject = wmi.Get(0)
SystemManufacturer = Convert.ToString(SystemInfo.Properties("Manufacturer").Value)
SystemProductName = Convert.ToString(SystemInfo.Properties("Model").Value)
SystemFamily = I don't know how to get it.
SKUNumber = I don't know how to get it.
End Using
End Using
' Get BIOS Info.
Using wmi As New Management.ManagementObjectSearcher("select * from Win32_BIOS")
Using BIOSInfo As Management.ManagementObject = wmi.Get(0)
BIOSVersion = Convert.ToString(BIOSInfo.Properties("SMBIOSBIOSVersion").Value)
BIOSVendor = I don't know how to get it.
BIOSMajorRelease = I don't know how to get it.
BIOSMinorRelease = I don't know how to get it.
End Using
End Using ' wmi
HardwareId = BIOSVersion & BIOSVendor & BIOSMajorRelease & BIOSMinorRelease &
SystemManufacturer & SystemFamily & SystemProductName & SKUNumber
' Here I call other method to encode the resulting string to SHA1 Hash
HardwareId = ConvertToSHA1(HardwareId)
' and then continue below...
' But this will not work,
' it throws an exception about missing "-" chars in the SHA1 string.
' So Microsoft formats "manualy" the SHA1 string to add some "-"?
Return Guid.Parse(HardwareId)
End Function