From a951e8d90fcd994be83b21dad04a1c6da14f6ca7 Mon Sep 17 00:00:00 2001 From: le-garff-yoann Date: Wed, 25 Jul 2018 23:46:09 +0200 Subject: [PATCH] Make shutdown work on Nano Server --- plugins/guests/windows/cap/halt.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/guests/windows/cap/halt.rb b/plugins/guests/windows/cap/halt.rb index a5d6e2125..a14abd925 100644 --- a/plugins/guests/windows/cap/halt.rb +++ b/plugins/guests/windows/cap/halt.rb @@ -8,7 +8,11 @@ module VagrantPlugins machine.communicate.execute("shutdown -a", error_check: false) # Force shutdown the machine now - machine.communicate.execute("shutdown /s /t 1 /c \"Vagrant Halt\" /f /d p:4:1") + begin + machine.communicate.execute("shutdown /s /t 1 /c \"Vagrant Halt\" /f /d p:4:1") + rescue Vagrant::Errors::VagrantError + machine.communicate.execute("shutdown /s /t 1 /c \"Vagrant Halt\" /f") + end end end end