Problem
If you add a command to a deployment that executes a Powershell script e.g. PowerShell.exe -File powershell.ps1 using the Command or Advanced Command plugin, there is a potential that it will execute without stopping when the command is run during deployment.
The step will appear in your deployment as if it is currently executing.
Cause
The Command and Advanced command plugins operate by adding the specified command to a Windows batch file (*.bat), uploading that file to the target host, and executing it. It is possible that the batch will complete before the script and XL Deploy thus receives no signal the script execution has completed.
Solution
In most cases simply adding NUL to the command line will allow the batch file to wait for the Powershell script to complete:
PowerShell.exe -File powershell.ps1 < NUL
An alternate approach would be to introduce a wait to the execution of the command.
START WAIT PowerShell.exe "& "powershell.ps1"
Comments
Please sign in to leave a comment.