Running Powershell script from command in deployment: step execution does not complete

Problem: If you add a command to a deployment that executes a Powershell script e.g. PowerShell.exe -File powershell.ps1 using the Commandor Advanced Commandplugin, 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 Commandand Advancedcommand 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 Deploythus 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"

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.