Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Can one set a variable via the command line ?

I would like to set a PDQ Deploy variable via the command line and then access that variable by a deployment. Can a variable be set via the command line?

Thanks, Nick

0

Comments

2 comments
Date Votes
  • That's a pretty general question I think it depends on the context of what you're trying to accomplish. But I have pretty general answer: You could write to a file and check it later. For example,

    echo yes > %WINDIR%\AdminArsenal\pending_reboot.txt
    

    Then add a reboot step with a condition that depends if that file exists. Or if you need to read in the contents of the text file to retrieve a variable value you could use powershell,

    $reboot_yes_no = "no" # this would be the default value
    $reboot_variable = $env:windir\AdminArsenal\pending_reboot.txt
    if(Test-Path $reboot_variable){
      $reboot_yes_no = Get-Content $reboot_variable;
      $reboot_yes_no = $reboot_yes_no.Trim() # this would be the new value read-in from the file
      Remove-Item -Path $reboot_variable -Force # delete the file after for clean up.
    }
    
    if($reboot_yes_no -eq "yes"){
      Restart-Computer
    }
    

    You get the idea.

    0
  • If you're looking to update an existing Custom Variable, the UpdateCustomVariable command was added a while back (I don't remember which version).

    PDQDeploy.exe Help UpdateCustomVariable
    0