diff --git a/lib/chef/provisioning/transport/winrm.rb b/lib/chef/provisioning/transport/winrm.rb index 270b8b60..68e38ae5 100644 --- a/lib/chef/provisioning/transport/winrm.rb +++ b/lib/chef/provisioning/transport/winrm.rb @@ -57,7 +57,11 @@ def read_file(path) end def write_file(path, content) - execute("New-Item -Type Directory -Force -Path #{escape(::File.dirname(path))}").error! + execute(" +if((Test-Path(#{escape(::File.dirname(path))})) -eq 0) +{ + New-Item -Type Directory -Force -Path #{escape(::File.dirname(path))} +}").error! chunk_size = options[:chunk_size] || 1024 # TODO if we could marshal this data directly, we wouldn't have to base64 or do this godawful slow stuff :( index = 0