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
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:
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:
Copyright © 1996-2020 Cadzow TECH Pty. Ltd. All rights reserved.
Question/comment about this page? Please email firstname.lastname@example.org