What the Error Code Means
The "Access Denied" error in a Hyper-V virtual machine (VM) network occurs when the guest OS cannot obtain an IP address, connect to the internet, or see other devices on the network. The full system error text often includes the code 0x80070005. The problem arises on the first VM launch after creation or after changes to the host's network. The diagnostic screen in the guest OS may show "Network access denied" or "Failed to obtain an IP address".
Causes
The error is caused by security restrictions and configuration conflicts:
- Hyper-V's default isolation. Virtual machines in "External" mode use a virtual switch that, by policy, blocks direct access to the physical adapter to prevent attacks.
- Firewall/antivirus policy conflicts. Third-party antiviruses (Kaspersky, Avast, etc.) or the Windows Firewall may block traffic for the
vEthernetvirtual switch. - Corrupted or misconfigured virtual switch. After a Windows update or power failure, the switch configuration may become invalid.
- Insufficient permissions for the Hyper-V account. The Hyper-V system service (
vmms) lacks sufficient rights to manage network adapters (often after manual registry editing).
Solutions
Method 1: Switch Network Adapter to NAT Mode (Fastest)
NAT (Network Address Translation) mode provides the VM with internet access through the host's primary adapter, bypassing isolation issues.
- Open Hyper-V Manager (Win+R β
virtmgmt.msc). - In the VM list, select the problematic VM, right-click β Settings.
- In the left pane, go to Network Adapter.
- In the Virtual Switch section, select the switch labeled NAT from the list (if none exists, create one via Virtual Switch Manager β Create Virtual Switch β Internal type).
- Click OK and restart the virtual machine.
- In the guest OS, run
ipconfig /releaseandipconfig /renewto obtain a new IP.
π‘ Tip: A NAT switch usually automatically creates a
192.168.x.xsubnet. Ensure DHCP is enabled in the host's adapter settings (inHyper-V Virtual Ethernet Adapter).
Method 2: Delete and Recreate the Virtual Switch
If the problem is a corrupted switch, it must be completely removed and recreated.
- In Hyper-V Manager, click Actions (on the right) β Virtual Switch Manager.
- Select the problematic switch (e.g.,
External) and click Remove. - Click Create Virtual Switch.
- Select the type:
- External β for direct access to the physical network (requires admin rights).
- Internal β for communication only between VMs and the host (no internet).
- Private β only between VMs.
- Specify the physical network adapter (for External type).
- Click OK, wait for application.
- Return to the VM's settings and bind the network adapter to the new switch.
- Restart the VM.
Method 3: Configure Isolation Policy via PowerShell (Advanced)
For advanced users: allow the hypervisor to manage network adapter teaming, which lifts certain restrictions.
- Launch PowerShell as Administrator.
- Run the command, substituting your VM's name:
Set-VMNetworkAdapter -VMName "YourVMName" -AllowTeaming On
- You can also reset the adapter settings:
Remove-VMNetworkAdapter -VMName "YourVMName" -Name "Network Adapter"
Add-VMNetworkAdapter -VMName "YourVMName" -SwitchName "SwitchName"
- Restart the VM.
Method 4: Manual Registry Permissions Fix (Last Resort)
If the error is caused by insufficient permissions for the Hyper-V service, you must manually grant permissions.
- Press Win+R, type
regedit, confirm UAC. - Navigate to the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization - Right-click the Virtualization folder β Permissions....
- Click Add, enter
SYSTEMandLOCAL SERVICE. - For each of these accounts, check Full Control.
- Click Apply and OK.
- Restart the computer (the host, not just the VM).
- Start the VM and check the network.
β οΈ Important: Be careful when editing the registry. Export the key (
File β Export) before making changes.
Prevention
To avoid the error recurring:
- Use NAT mode for most VMs unless direct connection to the local network is required.
- Regularly update Windows β updates often contain fixes for Hyper-V.
- Avoid installing multiple antiviruses simultaneously. If using a third-party one, add exclusions for the folders
C:\ProgramData\Microsoft\Windows\Hyper-VandC:\Windows\System32\vmms.exe. - Do not disable the Hyper-V Virtual Machine Management (
vmms) service β it is critical for network operation. - After major Windows updates, recreate virtual switches if problems arise.
# Command to quickly check the status of VM network adapters
Get-VMNetworkAdapter -VMName "VMName" | Format-List Name, SwitchName, AllowTeaming