From 820d80852c69b47295ecb2949bd74b4c4775c1e2 Mon Sep 17 00:00:00 2001 From: Taliesin Sisson Date: Thu, 10 Aug 2017 11:14:52 +0100 Subject: [PATCH] If this is called during a shutdown then exception code 1115 is throw. --- plugins/guests/windows/scripts/reboot_detect.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/guests/windows/scripts/reboot_detect.ps1 b/plugins/guests/windows/scripts/reboot_detect.ps1 index fa2e84ffe..93688ad73 100644 --- a/plugins/guests/windows/scripts/reboot_detect.ps1 +++ b/plugins/guests/windows/scripts/reboot_detect.ps1 @@ -32,6 +32,11 @@ if (ShuttingDown) { exit 2 } + if ($LASTEXITCODE -eq 1115) { + # A system shutdown is in progress + exit 2 + } + # Remove the pending reboot we just created above if ($LASTEXITCODE -eq 0) { . shutdown.exe -a