Block Internet Access to a Hyper-V VM

When building reference images for Windows 10 or Windows 11 it's quite useful to block Internet access to that VM (to prevent unwanted updates). This can obviously be done on the router level if using a virtual router, but you can also use native Hyper-V functionality to block a single VM from Internet access.

Here is a short script to do that, and in this example my default gateway was 192.168.50.1:

# Block Internet access for the REF001 VM
Add-VMNetworkAdapterAcl -VMName REF001 -RemoteIPAddress 192.168.50.1 -Direction Both -Action Deny

If you want to review existing rules, use this script:

# Get rules for the REF001 VM
Get-VMNetworkAdapterAcl -VMName REF001
About the author

Johan Arwidmark

5 2 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Sean
Sean
2 years ago

Hi Johan, this disabled the connection between the host machine and the VM too. I created a switch with "Internal Switch" type, but I don't want the VM to be able to access internet, however, I do want to be able to connect to VM from the host. The old "Internal Switch" does exactly that, but I recently upgraded to Windows 11, and "Internal Switch" now default to allow VM to connect to internet. I don't want that, I don't want the VM to connect to internet and get unwanted updates. How can I do that? Thanks, your post was… Read more »


>