I am trying to detect the activation of the TPM by querying WMI. I stared with wanting to see what values resulted from querying the string with:
string values of selects "IsActivated_InitialValue from Win32_Tpm" of wmi as string
but it errors out with An error occurred while communicating with the client.
I have tried both the local client evaluation and local debugger and the result is the same.
I then moved to trying another statement of
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 "Activated" ELSE "Not Activated") as string) else "Undetected"
I have come across this as well with WMI, particularly with Windows 10. This is because the relevance through the console is evaluated with SYSTEM privileges, while the Fixlet Debugger is run as Admin.
You must execute the Fixlet Debugger as SYSTEM using PSExec to put it at similar permission level, and even then the results may not always match.