StefanScherer / packer-windows

Windows Templates for Packer: Windows 11, Windows 10, Windows Server 2022, 2019, 2016, also with Docker
MIT License
1.28k stars 430 forks source link

Windows 10 December 2022 updates break the enable-winrm.ps1 script #322

Closed corbob closed 1 year ago

corbob commented 1 year ago

This line: https://github.com/StefanScherer/packer-windows/blob/02c28376379d68d7e03f0056cfedd241e93879b3/scripts/enable-winrm.ps1#L2 no longer returns an actionable object.

Left is from a system before the December updates were applied, and right is after they're applied.

image

corbob commented 1 year ago

Ok, for my setup, I was able to remove the first 3 lines:

https://github.com/StefanScherer/packer-windows/blob/02c28376379d68d7e03f0056cfedd241e93879b3/scripts/enable-winrm.ps1#L1-L3

And replace them with one line:

Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

However, I have no idea if this works with Server Operating Systems, or with anything other than Windows 10 22H2.

jasontarry commented 1 year ago

I can confirm the same issue and fix is required in Windows 11 22H2, thank you for sharing

ccraluca commented 1 year ago

Hi @corbob, I tried your solution but it didn't work. Could this error be related to the same update? I couldn't find a fix and this came out without making any changes to the code. image

sva-mk commented 1 year ago

I can confirm that the issue is still present on 21H2. For me, the fix from corbob solved the problem! Thanks for sharing your work!

Ok, for my setup, I was able to remove the first 3 lines:

https://github.com/StefanScherer/packer-windows/blob/02c28376379d68d7e03f0056cfedd241e93879b3/scripts/enable-winrm.ps1#L1-L3

And replace them with one line:

Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

However, I have no idea if this works with Server Operating Systems, or with anything other than Windows 10 22H2.

imincik commented 1 year ago

I confirm the issue while running packer build --only=virtualbox-iso ./windows_10.json. And I also confirm that patch from @corbob fixed the problem. Thank you @corbob .

StefanScherer commented 1 year ago

Do we have any confirmation if this change works on Windows Server OS? I moved away from Intel MBP, so I can't test locally.