Hi,
I have ebextensios script that enable IIS-WebSockets and then a step to reboot the machine to enable it (cause enabling this feture requires reboot) but the reboot fails.
files:
"C:/mysetup/app-server.ps1":
content: |
$LASTEXITCODE = 0
Write-Host "Unistall Windows Defender";
Uninstall-WindowsFeature -Name Windows-Defender
Write-Host "Enable IIS WebSockets";
Enable-WindowsOptionalFeature -FeatureName IIS-WebSockets -Online -NoRestart
exit $LASTEXITCODE
container_commands:
03-configure-application-server:
command: powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:/mysetup/app-server.ps1"
ignoreErrors: true
waitAfterCompletion: 0
04-reboot-server:
command: powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Restart-Computer -Confirm -Force"
waitAfterCompletion: 0
I tried iven with waitAfterCompletion: forever.
Here's the error I get:
2022-10-25 12:26:30,420 [INFO] Command 03-configure-application-server succeeded
2022-10-25 12:26:31,822 [ERROR] Command 04-reboot-server (powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Restart-Computer -Confirm -Force") failed
2022-10-25 12:26:31,822 [ERROR] Error encountered during build of postbuild_1_pcube: Command 04-reboot-server failed
Traceback (most recent call last):
File "cfnbootstrap\construction.pyc", line 578, in run_config
File "cfnbootstrap\construction.pyc", line 146, in run_commands
File "cfnbootstrap\command_tool.pyc", line 127, in apply
cfnbootstrap.construction_errors.ToolError: Command 04-reboot-server failed
2022-10-25 12:26:31,822 [ERROR] -----------------------BUILD FAILED!------------------------
2022-10-25 12:26:31,822 [ERROR] Unhandled exception during build: Command 04-reboot-server failed
Traceback (most recent call last):
File "cfn-init", line 176, in <module>
File "cfnbootstrap\construction.pyc", line 137, in build
File "cfnbootstrap\construction.pyc", line 564, in build
File "cfnbootstrap\construction.pyc", line 578, in run_config
File "cfnbootstrap\construction.pyc", line 146, in run_commands
File "cfnbootstrap\command_tool.pyc", line 127, in apply
cfnbootstrap.construction_errors.ToolError: Command 04-reboot-server failed
Thanks
Michele