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.

Pass variables to new deployment?

Powershell/Deploy Question.

We only have PowerShell remoting on servers. I am using this command from one deployment to call another deployment to a separate machine.

Invoke-Command -ComputerName $(PDQDeployServerHostName) -ScriptBlock { param ($compname) & 'C:\Program Files (x86)\Admin Arsenal\PDQ Deploy\pdqdeploy.exe' Deploy -Package "Package Name Here" -Targets $using:CompVariable} -ArgumentList "$env:COMPUTERNAME"

[EDIT: The command works fine, I'm just looking to pass string variables to a new deployment that a PowerShell step could pick up.]

I saw that you can't pass variables between steps, but Is possible to pass PowerShell variables between new pdq deployments or is that still the same thing?

I'm trying to not utilize the PDQ Custom Variables for this because they limit my overall deployment to one computer at a time.

Thank you for your time.



Date Votes
  • I don't quite understand your setup. Are you trying to use Deploy to invoke another instance of Deploy?

  • Yes, that is what I am doing but wanting to pass variables. It's a bit of a kludge.

    To explain better, I'm using PDQ Inventory and Deploy backup and move user profiles over the network. Everything works great, but I'm limited to doing one computer at a time and waiting for the entire process to finish because of PDQ custom variables. I'm looking to improve it.

    Steps go:

    PDQ Inventory

    1. Run tool on computer, PowerShell opens, lists users.
    2. Asks admin what user to backup.
    3. Lists AD computers.
    4. Asks admin what computer to restore to.
    5. Pass Username and Computer Variables inputted to PDQ Deploy Custom Variables (overwriting existing ones).
    6. Starts PDQ Deployment Package that backs up user.

    PDQ Deploy Backup Deployment - 1 Raw Powershell step

    1. It saves the custom pdq variables in PowerShell variables and then starts user backup. 
    2. At the end of the step it calls for another deployment to go to the target machine to restore the user profile on.

    PDQ Deploy Restore Package - 1 Raw Powershell step

    1. It starts the user restore process but because it's a new package I have it use the PDQ custom variable (which can change if I do a second computer).

    If I were to backup/restore to 2 computers back to back there is a chance that when restoring that it would grab the wrong PDQ custom variable. So I want to pass a PowerShell variable over instead which should allow multiple computers to run without waiting for the entire process to finish before doing another computer.

  • Here's my idea:

    Inventory Tool

    • Run Type = System.
    • Prompt for username, source, and destination.
    • Write the username to USERNAME.TXT and copy it to both targets.
    • Deploy the SOURCE and DESTINATION packages to the respective targets.

    SOURCE Package

    • Read USERNAME.TXT.
    • Back up the user's files to a fileshare.
    • Write an empty file named DONE.TXT to the fileshare when the backup is complete.
    • Delete USERNAME.TXT.

    TARGET Package

    • Read USERNAME.TXT.
    • Wait for DONE.TXT to appear.
    • Restore the files.
    • Delete USERNAME.TXT.
  • Thank you Colby.

    Finally had time to use your suggestion and with a little modification it worked out very well.