PowerShell scripts for integrating PDQ Deploy with MDT (Microsoft Deployment Toolkit) task sequences.
Integrates PDQ Deploy into MDT task sequences for post-imaging software deployment.
- Copies PsExec locally - From MDT deployment share to Windows directory
- Configures networking - Registers DNS and optionally configures firewall
- Triggers PDQ deployment - Executes a PDQ Deploy package on the local machine
- Waits for completion - Monitors PDQ deployment and exits when done
- Extend MDT task sequences with PDQ Deploy's superior package management
- Deploy software that requires user context or complex sequencing
- Bridge the gap between OS deployment (MDT) and software deployment (PDQ)
- Place
PsExec.exein your MDT Deployment Share\Scriptsfolder - Configure PDQ Deploy with a package (e.g., "New PC Setup")
- Add this script as the final step in your MDT task sequence
.\mdt-pdq-psexec.ps1.\mdt-pdq-psexec.ps1 `
-MDTScriptsPath "\\mdt01\DeploymentShare$\Scripts" `
-PDQHost "pdq01.corp.local" `
-PackageName "Standard Desktop" `
-TimeoutMinutes 90.\mdt-pdq-psexec.ps1 -WhatIf| Parameter | Type | Default | Description |
|---|---|---|---|
MDTScriptsPath |
String | \\PATH-TO-Deploymentshare\Scripts |
UNC path to MDT Scripts folder containing PsExec.exe |
PDQHost |
String | pdq.host.fqdn |
FQDN of the PDQ Deploy server |
PackageName |
String | New PC Setup |
Name of the PDQ Deploy package to run |
DisableFirewall |
Switch | $false |
Not recommended - Disables firewall entirely instead of adding rules |
TimeoutMinutes |
Int | 60 | Maximum wait time for PDQ deployment (1-240 minutes) |
- Windows PowerShell 5.1 or PowerShell 7+
- Administrator privileges (enforced via
#Requires) - PsExec.exe in specified MDT Scripts path
- PDQ Deploy server configured for remote deployments
- Network connectivity between target and PDQ server
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Not running as administrator |
| 2 | MDT scripts path not accessible |
| 3 | PsExec copy failed |
| 4 | PDQ deployment timed out |
| 5 | PDQ deployment failed to start |
Script creates detailed logs in %TEMP%\MDT-PDQ-Deploy_YYYYMMDD_HHMMSS.log
By default, the script adds specific firewall rules for PDQ Deploy rather than disabling the firewall:
- TCP ports 6336, 6337
- UDP ports 6336, 6337
Use -DisableFirewall only if you understand the security implications.
- Verify the
MDTScriptsPathparameter points to your MDT Scripts folder - Ensure PsExec.exe exists in that folder
- Increase
-TimeoutMinutesif your package takes longer - Check PDQ Deploy console for deployment status
- Verify the PDQ server can communicate with the target
- Ensure running as Administrator
- Check that the PDQ Deploy service account has rights to the target
- Verify the package name matches exactly in PDQ Deploy
- Check PDQ Deploy logs on the server
- Ensure the target computer is in PDQ Inventory
- PsExec is copied to
C:\Windowstemporarily - Firewall rules are added for PDQ communication
- Script requires Administrator privileges
- Consider removing PsExec after deployment (uncomment cleanup section)
- Added comprehensive logging
- Added parameter support
- Added timeout protection
- Added
-WhatIfsupport - Improved error handling
- Added firewall rule option vs. disable
- Added exit codes
- Added progress indication
- Initial release
MIT License - Use at your own risk.