I am trying to run a powershell command within a json file which is for cloudformation template. I am getting errors with anything after the pipe(|) symbol.
This is a new script that needs to work for our templates.
"commands": {
"UpdateAbsolutePath": {
"command": "powershell.exe -Command ((Get-Content -path D:\\Tomcat-8.0\\webapps\\lease_accelerator\\WEB-INF\\web.xml -Raw) -Replace \"LA-AWS-SU1-APP1\",\"LA-AWS-SU2-APP1\") | Set-Content -Path D:\\Tomcat-8.0\\webapps\\lease_accelerator\\WEB-INF\\web.xml"
}
I expect it to run fine, but I get the following error:
[DEBUG] No services specified
2019-06-05 13:49:01,572 [DEBUG] Running command UpdateAbsolutePath
2019-06-05 13:49:01,588 [DEBUG] No test for command UpdateAbsolutePath
2019-06-05 13:49:01,618 [ERROR] Command UpdateAbsolutePath (powershell.exe -Command ((Get-Content -path D:\Tomcat-8.0\webapps\lease_accelerator\WEB-INF\web.xml -Raw) -Replace "LA-AWS-SU1-APP1","LA-AWS-SU2-APP1") | Set-Content -Path D:\Tomcat-8.0\webapps\lease_accelerator\WEB-INF\web.xml) failed
2019-06-05 13:49:01,618 [DEBUG] Command UpdateAbsolutePath output: 'Set-Content' is not recognized as an internal or external command,
operable program or batch file.
2019-06-05 13:49:01,618 [ERROR] Error encountered during build of config: Command UpdateAbsolutePath failed
Traceback (most recent call last):
File "cfnbootstrap\construction.pyc", line 513, in run_config
File "cfnbootstrap\construction.pyc", line 125, in run_commands
File "cfnbootstrap\command_tool.pyc", line 113, in apply
ToolError: Command UpdateAbsolutePath failed
2019-06-05 13:49:01,618 [ERROR] -----------------------BUILD FAILED!-----
-------------------
2019-06-05 13:49:01,618 [ERROR] Unhandled exception during build: Command UpdateAbsolutePath failed
Traceback (most recent call last):
File "cfn-init", line 123, in <module>
File "cfnbootstrap\construction.pyc", line 117, in build
File "cfnbootstrap\construction.pyc", line 502, in build
File "cfnbootstrap\construction.pyc", line 513, in run_config
File "cfnbootstrap\construction.pyc", line 125, in run_commands
File "cfnbootstrap\command_tool.pyc", line 113, in apply
ToolError: Command UpdateAbsolutePath failed`