Micorosoft BitLocker Protection and TPM Status

(imported topic written by SystemAdmin)

In case anybody out there needs to gather information on:

BitLocker Protection status:

if (exists wmi 
"root\CIMv2\Security\MicrosoftVolumeEncryption") then ((

if (exists (select objects 
"ProtectionStatus, DriveLetter from Win32_EncryptableVolume" of wmi 
"root\CIMv2\Security\MicrosoftVolumeEncryption") whose ((integer value of property 
"ProtectionStatus" of it = 1 AND string value of property 
"DriveLetter" of it = 
"C:") )) then 
"BitLocker Encrypted" ELSE 
"Drive Not Encrypted") as string) 

else 
"BitLocker Status Undetectable"

TPM Enabled:

if (exists wmi 
"root\CIMV2\Security\MicrosoftTpm") then ((

if (exists (select objects 
"IsEnabled_InitialValue from Win32_Tpm" of wmi 
"root\CIMV2\Security\MicrosoftTpm") whose ((string value of property 
"IsEnabled_InitialValue" of it = 
"True") )) then 
"TPM Enabled" ELSE 
"TPM Disabled") as string) 

else 
"TPM Enabled Undetectable"

TPM Encrypted:

if (exists wmi 
"root\CIMV2\Security\MicrosoftTpm") then ((

if (exists (select objects 
"IsActivated_InitialValue from Win32_Tpm" of wmi 
"root\CIMV2\Security\MicrosoftTpm") whose ((string value of property 
"IsActivated_InitialValue" of it = 
"True") )) then 
"TPM Activated" ELSE 
"TPM Not Activated") as string) 

else 
"TPM Activated Undetectable"