Determining the UUID of a computer

by Mitch Tulloch [Published on 25 Feb. 2011 / Last Updated on 8 Dec. 2009]

How to use WMI to determine the UUID of a computer.

Microsoft Deployment Toolkit allows you to customize Windows deployment based on the target computer's UUID. But how can you determine the UUID of the target computer?

First, try the obvious things, namely:

- Check for a sticker on the outside or inside of the case

- Check in the BIOS or in the BIOS settings displayed when the computer starts.

- Check the invoice and other documentation you received from the vendor.

If none of these provide you with the computer's UUID and you already have a Windows operating system installed on the computer, you can customize and use the following WMI script to determine your computer's UUID:

' DisplayClassProperties.vbs
'
' Used to find the UUID of a specific desktop computer
'
' By Mitch Tulloch (www.mtit.com)

Option Explicit
On Error Resume Next
Dim strComputer
Dim strWMINamespace
Dim strWMIQuery
Dim objWMIService
Dim colItems
Dim objItem

strComputer = "."
strWMINamespace = "\root\CIMV2"
strWMIQuery = ":Win32_ComputerSystemProduct.IdentifyingNumber='MXG5380254 NA540',Name='PY196AV-ABA a1130e',Version='0n31211CT101AMBEM00'"

' NOTE: You will need to use wbemtest.exe to determine how to modify the above line for your computer
' To learn how to do this, see this article by me on WindowsNetworking.com:
' Managing Windows Networks Using Scripts - Part 13: A Handy Return-All-Values Script
' http://www.windowsnetworking.com/articles_tutorials/Managing-Windows-Networks-Using-Scripts-Part13.html

Set objWMIService = GetObject("winmgmts:\\" & strComputer & strWMINamespace & strWMIQuery)
WScript.Echo "Number of properties of " & strWMIQuery & " class is " & objWMIService.Properties_.count

For Each objItem in objWMIService.Properties_
Wscript.Echo "Property: " & objItem.name & vbTab & "Value: " & objItem.value
Next

If you have feedback concerning this tip, please email me. And be sure to check out my website!

Featured Links