Running PowerShell from MSdeploy runcommand does not exit

Posted by Peter Moberg on Stack Overflow See other posts from Stack Overflow or by Peter Moberg
Published on 2010-11-21T13:53:25Z Indexed on 2012/11/17 17:01 UTC
Read the original article Hit count: 1134

Filed under:
|
|

Im am trying to get MSDeploy to execute a PowerShell script on a remote server. This is how i execute MSDeploy:

msdeploy \
  -verb:sync \ 
  -source:runCommand='C:\temp\HelloWorld.bat', \
  waitInterval=15000,waitAttempts=1 \
  -dest:auto,computername=$WebDeployService$Credentials -verbose

HelloWorld.bat contains:

echo "Hello world!"
powershell.exe C:\temp\WebDeploy\Package\HelloWorld.ps1
echo "Done"

The HelloWorld.ps1 only contains:

Write-Host "Hello world from PowerShell!"

However, it seems like PowerShell never terminates. This is the output from running the msdeploy:

Verbose: Performing synchronization pass #1.
Verbose: Source runCommand (C:\temp\HelloWorld.bat) does not match destination (C:\temp\HelloWorld.bat) differing in attributes (isSource['True','False']). Update pending.
Info: Updating runCommand (C:\temp\HelloWorld.bat).
Info:

Info: C:\temp>echo "Hello world!"
"Hello world!"

C:\temp\WebDeploy>powershell.exe C:\temp\HelloWorld.ps1

Info: Hello world from Powershell!
Info:

Warning: The process 'C:\Windows\system32\cmd.exe' (command line '/c "C:\Users\peter\AppData\Local\Temp\gaskgh55.b2q.bat
"') is still running. Waiting for 15000 ms (attempt 1 of 1).
Error: The process 'C:\Windows\system32\cmd.exe' (command line '/c "C:\Users\peter\AppData\Local\Temp\gaskgh55.b2q.bat"'
) was terminated because it exceeded the wait time.
Error count: 1.

Anyone knows a solution?

© Stack Overflow or respective owner

Related posts about powershell

Related posts about msdeploy