Skip to content

Instantly share code, notes, and snippets.

@jamiechalmerzlp
Created August 12, 2022 10:12
Show Gist options
  • Save jamiechalmerzlp/dc7e184b109957ad32e86af004b43f53 to your computer and use it in GitHub Desktop.
Save jamiechalmerzlp/dc7e184b109957ad32e86af004b43f53 to your computer and use it in GitHub Desktop.
$TPMPRESENT = (Get-Tpm).TpmPresent
$TPMENABLED = (Get-Tpm).TpmEnabled
$TPMREADY = (Get-Tpm).TpmReady
$tpmVersion = Get-WmiObject -Class Win32_Tpm -Namespace root\CIMV2\Security\MicrosoftTpm | Select-Object -Property SpecVersion
$tpmVersionOut = $tpmVersion.SpecVersion.Split(",")[0] -as [string]
Write-Host "TPM Present: ${TPMPRESENT}, TPM Enabled: ${TPMENABLED}, TPM Ready ${TPMREADY}, TPM Version: ${tpmVersionOut}"
@jamiechalmerzlp
Copy link
Author

$Customfield="Custom14"

function Write-CustomField {
param([string]$Value,[string]$Field)
Set-ItemProperty -Path HKLM:\SOFTWARE\CentraStage -Name $Field -Value $Value
}

$TPMPRESENT = (Get-Tpm).TpmPresent
$TPMENABLED = (Get-Tpm).TpmEnabled
$TPMREADY = (Get-Tpm).TpmReady
$tpmVersion = Get-WmiObject -Class Win32_Tpm -Namespace root\CIMV2\Security\MicrosoftTpm | Select-Object -Property SpecVersion
$tpmVersionOut = $tpmVersion.SpecVersion.Split(",")[0] -as [string]

Write-Host "TPM Present: ${TPMPRESENT}, TPM Enabled: ${TPMENABLED}, TPM Ready ${TPMREADY}, TPM Version: ${tpmVersionOut}"

$output = "TPM Present: ${TPMPRESENT}, TPM Enabled: ${TPMENABLED}, TPM Ready ${TPMREADY}, TPM Version: ${tpmVersionOut}"

Write-CustomField -Value "$output" -Field $Customfield

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment