MicrosoftDocs / WSL

Source code behind the Windows Subsystem for Linux documentation.
https://docs.microsoft.com/windows/wsl
Other
1.88k stars 556 forks source link

instruction fails (Set-NetFirewallHyperVVMSetting -Name ‘{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}’ -DefaultInboundAction Allow) #1869

Open ckuhtz opened 7 months ago

ckuhtz commented 7 months ago

Documentation Issue

Set-NetFirewallHyperVVMSetting -Name ‘{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}’ -DefaultInboundAction Allow

to allow inbound fails with:

PS C:\WINDOWS\system32> Set-NetFirewallHyperVVMSetting -Name {40E0AC32-46A5-438A-A0B2-2B479E8F2E90} -DefaultInboundAction Allow Set-NetFirewallHyperVVMSetting : No MSFT_NetFirewallHyperVVMSetting objects found with property 'Name' equal to '40E0AC32-46A5-438A-A0B2-2B479E8F2E90'. Verify the value of the property and retry. At line:1 char:1

in an elevated PowerShell prompt.

Link to documentation page

https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking

Suggested Improvements

What is the correct instruction here? How do you find out what the VMCreatorId is?

ghost commented 4 months ago

The answer is easy:

compare what is copied from the Docs with what arrives in the powershell:

Copy: Set-NetFirewallHyperVVMSetting -Name ‘{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}’ -DefaultInboundAction Allow Arrive: Set-NetFirewallHyperVVMSetting -Name {40E0AC32-46A5-438A-A0B2-2B479E8F2E90} -DefaultInboundAction Allow

In the docs is the wrong type of apostrophe used. Compare: https://en.wikipedia.org/wiki/Apostrophe Be aware that the second codeline is also affected (LEFT DOUBLE QUOTATION MARK).

Therefore add the ' manually. I will open a ticket to fix the docs.

cotneit commented 3 months ago

@leolerbssiedle have you actually tried it?

Replacing ‘{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}’ with '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' doesn't make a difference.

Yunuuuu commented 3 months ago

The same problem, I don't copy code from the document but learn step by step from: https://learn.microsoft.com/en-us/windows/security/operating-system-security/network-security/windows-firewall/hyper-v-firewall

Set-NetFirewallHyperVVMSetting cannot match the name.

gscofano-uff commented 3 months ago

Exact same issue here.

Update: just fixed it.

I had already made sure that I was running Windows with a version superior than 22H2 (mine was 23H2) and WSL 2 and even so I was having this issue with WSL. I had already tried to shutdown the WSL and open it again, with no success. I fixed by updating the WSL with the following command:

PS C:\Users\user> wsl --update

When I started the WSL again, it had the same network interfaces available in the host OS.

feng-yifan commented 1 week ago

The same problem, I don't copy code from the document but learn step by step from: https://learn.microsoft.com/en-us/windows/security/operating-system-security/network-security/windows-firewall/hyper-v-firewall

Set-NetFirewallHyperVVMSetting cannot match the name.

I tried command like this Get-NetFirewallHyperVRule -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}', but it told me this VMCreator not exist

feng-yifan commented 1 week ago

try run wsl --update may solve your problem