Cadzow Knowledgebase

Normal view

Scripting: Determine TPM Vendor

From an elevated command prompt, the following command returns the TPM vendor:

wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get ManufacturerId /value

For example:

ManufacturerId=1229346816

To parse this in a batch script:

for /f "skip=2 tokens=1,* delims==" %%x in ('wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get ManufacturerId /value') do if '%%y NEQ ' set TPMVendor=%%y

If a TPM chip is not installed, this command echoes No Instance(s) Available to the error console, and the parsing doesn't work properly. So the error output could be redirected and the above can be expanded:

set TPMVendor=None

for /f "skip=2 tokens=1,* delims==" %%x in ('wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get ManufacturerId /value 2^>nul') do if '%%y NEQ ' set TPMVendor=%%y

In this example, 2>nul outputs the error text to the Null device, and the caret (^) is used in the for loop to indicate the next character should be used literally and not interpreted.

The manufacturer ID is a 32-bit (ie. 4 byte) integer where each byte represents the ASCII value of the vendor's short name as specified here. Some short names are three characters long, some are four, and some are three but padded with a space at the end. In any case parsing the four bytes in a script is tedious when the list of vendors is relatively short and unchanging:

AMD1095582720
Ant Group1095652352
Atmel1096043852
Broadcom1112687437
Cisco1129530191
Flyslice Technologies1179408723
Fuzhou Rockchip1380926275
Google1196379975
HP Inc1213221120
HP Enterprise1213220096
Huawei1212765001
IBM1229081856
Infineon1229346816
Intel1229870147
Lenovo1279610368
Microsoft1297303124
National Semiconductor1314082080
Nationz1314150912
Nuvoton Technology1314145024
Qualcomm1363365709
Samsung1397576526
Sinosun1397641984
SMSC1397576515
STMicroelectronics1398033696
Texas Instruments1415073280
Winbond1464156928




Copyright © 1996-2023 Cadzow TECH Pty. Ltd. All rights reserved.
Information and prices contained in this website may change without notice. Terms of use.

Question/comment about this page? Please email webguru@cadzow.com.au