From affebcda869f55c9c0a1c0f337350abc17b467bc Mon Sep 17 00:00:00 2001 From: Shawn Neal Date: Thu, 20 Aug 2015 13:25:27 -0700 Subject: [PATCH] Windows Powershell commands need to specify shell The WinRM communicator defaults to the regular Windows cmd shell so we need to tell Packer to use Powershell when running these guest commands. --- provisioner/guest_commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provisioner/guest_commands.go b/provisioner/guest_commands.go index 4a65312f9..85d45a05b 100644 --- a/provisioner/guest_commands.go +++ b/provisioner/guest_commands.go @@ -23,8 +23,8 @@ var guestOSTypeCommands = map[string]guestOSTypeCommand{ }, WindowsOSType: guestOSTypeCommand{ chmod: "echo 'skipping chmod %s %s'", // no-op - mkdir: "New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path %s", - removeDir: "rm %s -recurse -force", + mkdir: "powershell.exe -Command \"New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path %s\"", + removeDir: "powershell.exe -Command \"rm %s -recurse -force\"", }, }