Browse Tag: Software

MDT – Trigger PDQ Deploy after Deployment

PDQ Deploy is an amazing tool for deploying software across the network. Wouldn’t it be handy to trigger PDQ deployments after a successful image deployment from MDT? This would allow software such as Anti-virus, Microsoft Office etc to be installed automatically straight after installation. If you are interested, read on….

Configure PDQ Deploy to use TCP

For this to work, we can take advantage of the PDQ Deploy command line tool. Firstly, we need to make a quick registry edit on the PDQ Deploy server. Create a REG_DWORD key called ServicePort in the below hive:

HKEY_LOCAL_MACHINE\SOFTWARE\Admin Arsenal\PDQ Deploy

This key tells PDQ Deploy to use TCP for background service. Set the value to the TCP port number that you want to use (I set mine to 10649). Once that is done, close the PDQ Deploy console if it is open and restart the PDQ Deploy service for the changes to take effect. For more info, see the Admin Arsenal document here.

Creating the Powershell Script

Next, create a Powershell script in the scripts directory in your deployment share. Here is the contents of the script:

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

Remember to replace the hostname with the DNS name or IP of your PDQ Deploy server and the package name with the name of the package that you want to deploy after OS installation. If you are using a DNS name, the MDT clients must be able to resolve this name. If you want to deploy multiple packages, create a new PDQ package with the packages you want to deploy as nested packages. This script takes advantage of PS Remoting, so we will look at how to enable this next.

Enabling PS Remoting

To enable PS Remoting, launch Powershell as an administrator on your PDQ Deploy server and run Enable-PSRemoting then go to services and set the WinRM service startup type to automatic.

Adding to the Task Sequence

Now that we have everything setup, we need to tell MDT to run the script that we created. To do this, create a new CMD Command task and type this in the command box:

powershell -executionpolicy bypass "& ""\\MyMDTServer\DeploymentShare\Scripts\PDQ-Deploy-MDT.ps1"""

Make sure you update the UNC path to point to the script on your MDT server. Make sure that you run the task with a user who has console permissions on the PDQ Deploy server. Also, you may be thinking why not use a powershell task? This is because as far as I can see, there is no option to run a Powershell task as another user.

At this point, its time to test! Your deployment share will need to be updated before testing.

-B

See Also : MDT – Get Computer Name from PHP Script