I have a psake script to manage my deployments, the process is as follows:
- Compile & run tests
- Generate a deployment package using msbuild
- Check to see if we are deploying internally or externally
- If internal, execute the generated cmd file
- if external, prompt for username and password and execute the generated cmd file with the username and password as parameters
I'm executing msdeploy in the following manner when deploying externally:
exec { & $deploy_cmd /Y /M:$msdeploy_url /U:$user /P:$pwd /A:NTLM }
When the password contains an ampersand (&) then the cmd file, I assume, when assigning the parameter to a variable assigns the portion of the password before the & and tries to execute the portion afterwards. Which is bat file behaviour (& are used to separate commands).
I've tried escaping the password with the caret (^) during the prompt for the password, but that didn't work.
Other than changing the password, are there any other alternatives?