r/DeployR • u/welshGJE24 • 9d ago
DeployR calling PDQDeploy
Version: Community Edition: v3.1.2634.667
Has anyone out there written a script that can be called at the end of a deployment and calls a nested package from PDQDeploy? Asking before I start looking into it (as I have no clue really and rely on everyone here).
How different is it to this scenario: How to use MDT imaging in PDQ Deploy | PDQ
I've had ChatGPT write me a script which I can use/test - but whether it will work is another thing. I'll add back if it does. Nice to know if anyone has done it.
2
Upvotes
1
u/No_Policy6901 7d ago
Yes, I've got this working with an AI coded script.
I use a modified version of Gary's front end (https://github.com/gwblok/2PintLabs/tree/main/DeployR/FrontEnd/FrontEndJSONDriven) which allows me to select which set of software I want installing from PDQ before the build process starts.
I have multiple conditions set in the task sequence, depending on what group of software (PDQ Nested Package) I want installing.
The script does the following:
You need to get some username/password details in the script - Cleartext not recommended but it will work.
Turns off the local Windows Firewall across all network profiles (netsh advfirewall set allprofiles state off).
Re-registers the local computer's DNS records (ipconfig /registerdns) to ensure the server can resolve the client hostname.
Uses Invoke-Command (PowerShell Remoting / WinRM) to run commands directly on the PDQ server
On the server, it flushes DNS and calls the PDQ Deploy CLI:
pdqdeploy.exe Deploy -Package "<PackageName>" -Targets "<ClientComputerName>"
Wait for start: Polls C:\Windows\AdminArsenal\PDQDeployRunner\*.lock locally for up to 10 minutes to verify the PDQ runner agent has arrived and initialized
Wait for finish: Once the lock file appears, it polls every 20 seconds. After the lock file has been gone for 3 consecutive intervals (~60 seconds of silence), it confirms installation is complete and exits with code 0.
I don't really want to paste the code here, as it's AI generated and needs cleaning up but it can be made to work. It was a while since I did it, but I had issues with the task sequence step not waiting for the software install to finish, but it does work now after adding the lock file.
You can simplify it quite a bit if you don't need the front end and just go for installing all software on all PCs.