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


Daniel Robichau -

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"

Have more questions? Submit a request
  • Avatar

    In Command line how do i replace placeholders.

    For example my command line is

    Powershell -File {{fullpath}}\test.ps1 {{param1}} {{param2}}


    I saw a link in xebialabs explaining the params,but it is not that clear(explain the zip file ,how params are replacing from dictionary)



    Edited by maheswar