packer-community / winrmcp

Copy files to a remote host using WinRM
MIT License
58 stars 31 forks source link

Uploading files sometimes produces "Access is denied" errors #8

Open sneal opened 8 years ago

sneal commented 8 years ago

Posting this to start a discussion from a Packer group discussion

[[WSMAN ERROR CODE: 5]: <f:WSManFault Code='5' Machine='127.0.0.1' xmlns:f='http://schemas.microsoft.com/wbem/wsman/1/wsmanfault'><f:Message><f:ProviderFault path='%systemroot%\system32\winrscmd.dll' provider='Shell cmd plugin'>Access is denied. </f:ProviderFault></f:Message></f:WSManFault>]

I've seen this error reproduced outside this codebase via test-kitchen which is Ruby based, so its not necessarily a winrmcp lib problem. The common denominator seems to be uploading files to a Windows 2012R2 guest via WinRM from a Linux host. Oddly this seems to work fine from an OS X host.

sneal commented 8 years ago

Might be related to the network being set to public instead of work with VirtualBox...

jozefizso commented 8 years ago

I have problems with uploading VMWare windows.iso (102MB) from packer to Windows 7. I am running on Windows 10 Pro. The upload fails consistently even after several tries.

packer 0.8.6
VMware Workstation 12 Pro
Windows 7 Professional SP1
--> vmware-iso: Error uploading VMware Tools: Error uploading file to $env:TEMP\winrmcp-56b4a5be-9889-214a-65ea-17865dabf8b0.tmp: http error: 500
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xml:lang="en-US">
  <s:Header>
    <a:Action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault</a:Action>
    <a:MessageID>uuid:5F713771-EB61-422F-8C43-839FA7E9C6CB</a:MessageID>
    <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
    <a:RelatesTo>uuid:ecee6264-a016-412a-407e-684d861e8603</a:RelatesTo>
  </s:Header>
  <s:Body>
    <s:Fault>
      <s:Code>
        <s:Value>s:Sender</s:Value>
        <s:Subcode>
          <s:Value>w:AccessDenied</s:Value>
        </s:Subcode>
      </s:Code>
      <s:Reason>
        <s:Text xml:lang="en-US">Access is denied.</s:Text>
      </s:Reason>
      <s:Detail>
        <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="5" Machine="192.168.207.136">
          <f:Message>
            <f:ProviderFault provider="Shell cmd plugin" path="%systemroot%\system32\winrscmd.dll">Access is denied.</f:ProviderFault>
          </f:Message>
        </f:WSManFault>
      </s:Detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

WinRM config:

winrm quickconfig -q
winrm quickconfig -transport:http
winrm set winrm/config @{MaxTimeoutms="1800000"}
winrm set winrm/config/winrs @{MaxMemoryPerShellMB="2048"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
winrm set winrm/config/service/auth @{Basic="true"}
winrm set winrm/config/client/auth @{Basic="true"}
winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
dragon788 commented 8 years ago

I have seen this Access denied error on a Windows 7 host attempting to build Win2012R2 so I don't think it's platform specific.