Passing variables between commands with one single line command

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Jitendra Bisht Jitendra Bisht 1 year, 7 months ago.

  • Author
    Posts
  • #26862
    Profile photo of Jitendra Bisht
    Jitendra Bisht
    Participant

    Hi I am Jiten, Here's my question:
    I want to run two commands back to back. Command2 uses object of Command1.
    Eg.
    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.

    Regards,
    JB

  • #26866
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    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()
    
  • #26867
    Profile photo of Jitendra Bisht
    Jitendra Bisht
    Participant

    Thanks Man !! Its worked. Thanks alot.

    Regards,
    JB

You must be logged in to reply to this topic.