Passing variables between commands with one single line command

Hi I am Jiten, Here’s my question:
I want to run two commands back to back. Command2 uses object of Command1.
Command1: $ptt = Get-WmiObject -namespace “root/cimv2/security/microsofttpm” win32_tpm

Command2: $ptt.IsEnabled()

I am trying to run these command through Python Subprocess module. But problem is that i can run only i command at a time. I tried using Export-Clixml but in that also i have to run Import command first.

Kindly help me on this . I will be really grateful.


I don’t know anything about Python, but this can be run as a single command:

(Get-WmiObject -namespace "root/cimv2/security/microsofttpm" -Class win32_tpm).IsEnabled()

Thanks Man !! Its worked. Thanks alot.