So, seems the 401 cames because Auth basic is not enabled.

Can you confirm that got applied?


There are the commands that should make it work:

winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'


On Fri, Jul 21, 2017 at 3:12 PM, <[email protected]> wrote:

> yep, saw that. it doesn't work for some reason.
> Actuay, i don't care about ssl in winRM session, but 401 is really strange
> response..
>
> Alvaro Miranda Aguilera:
>>
>> so, did you check this thread?
>>
>>
>> https://groups.google.com/forum/#!topic/packer-tool/oCv78n2jcok
>>
>> is the firewall open?
>>
>> where you are running packer need to be able to reach that vm on the
>> winrm port
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>  Virusvrij.
>> www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>> <#m_8445387130396579752_CAHqq0exYLoy0su2D+hTtn-UzSsu3HnukasfV612tCfDBeFJMLw@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> On Fri, Jul 21, 2017 at 11:22 AM, <[email protected]> wrote:
>>
>>> I have a trouble with winRM connectivity, my configuration:
>>> *{*
>>> *  "variables": {*
>>> *  "startup_script": "winrm quickconfig -quiet & net user /add packer &
>>> net localgroup administrators packer /add & netsh advfirewall firewall set
>>> rule name=\"Windows Remote Management (HTTP-In)\" profile=public new
>>> remoteip=any & winrm set winrm/config/service @{AllowUnencrypted=\"true\"}
>>> & winrm set winrm/config/service/auth @{Basic=\"true\"} & powershell.exe
>>> -NoProfile -ExecutionPolicy Bypass -Command \"Set-ExecutionPolicy
>>> -ExecutionPolicy bypass -Force\""*
>>> *  },*
>>>
>>> *  "builders": [{*
>>> *    "type": "googlecompute",*
>>> *    "account_file": "acc.json",*
>>> *    "project_id": "test-project",*
>>> *    "source_image": "windows-server-2016-dc-v20170711",*
>>> *    "disk_size": "50",*
>>> *    "machine_type": "n1-standard-1",*
>>> *    "zone": "us-central1-a",*
>>> *    "network": "default",*
>>> *    "subnetwork": "default",*
>>> *    "omit_external_ip": true,*
>>> *    "use_internal_ip": true,*
>>> *    "instance_name": "win-base",*
>>> *    "communicator": "winrm",*
>>> *    "winrm_username": "packer",*
>>> *    "winrm_insecure": true,*
>>> *    "winrm_timeout": "3m",*
>>> *    "winrm_use_ssl": false,*
>>> *    "metadata": { "windows-startup-script-cmd": "{{user
>>> `startup_script`}}" }*
>>> *  }],*
>>> * "provisioners": [{*
>>> *    "type": "powershell",*
>>> *    "inline": [*
>>> *      "dir c:\\"*
>>> *    ]*
>>> *  }]*
>>> *}*
>>>
>>> in logs:
>>>
>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [INFO] Attempting WinRM
>>> connection...
>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [DEBUG] connecting to
>>> remote shell using WinRM
>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [ERROR] connection
>>> error: http response error: 401 - invalid content type
>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [ERROR] WinRM connection
>>> err: http response error: 401 - invalid content type
>>>
>>> when i'm trying to use *"winrm_use_ssl": true, *i recive trouble with *i/o
>>> timeout.*
>>>
>>> But more interesting fact was вiscovered on page
>>> https://www.packer.io/docs/provisioners/powershell.html:
>>> "The PowerShell Packer provisioner runs PowerShell scripts on Windows
>>> machines. It assumes that the communicator in use is WinRM."
>>> Which means: if i haven't ready-to-use WinRM - i haven't any
>>> provisioning.
>>>
>>> Could anybody look at the issue?
>>>
>>> --
>>> This mailing list is governed under the HashiCorp Community Guidelines -
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>>> violation of those guidelines may result in your removal from this mailing
>>> list.
>>>
>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>> IRC: #packer-tool on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/packer-tool/8f64ef54-f559-4527-a9cb-8c32028041f1%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/8f64ef54-f559-4527-a9cb-8c32028041f1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Alvaro
>>
>> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/588c1f51-2e20-4a78-9ff8-4135d9ccbb94%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/588c1f51-2e20-4a78-9ff8-4135d9ccbb94%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alvaro

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAHqq0ezyRP1ZK8UCg8BD%3D5d3NOgn-U2%2Br4StgRCRVN%2B5Yj_97g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to