Hidden Network Adapters in Azure VM and unable to access network resources

I have some Azure VM’s that I regulary Stop (deallocate) and Start using Azure Automation. The idea is to cut costs while at night or weekends, as these VM’s are not used then anyway. I recently had a problem with one of these Virtual Machines, I was unable to browse or connect to network resources, could not connect to the domain to get Group Policy updates and more. When looking into it, I found out that I had a lot of hidden Network Adapters in Device Manager. The cause of this is that every time a VM is shut down and deallocated, on next start it will provision a new network adapter. The old network adapter is kept hidden. The result of this over time as I automate shut down and start every day, is that I get a lot of these, as shown below: I found in some forums that the cause of the network browse problem I had with the server could be related to this for Azure VM’s. I don’t know the actual limit, or if it’s a fixed value, but the solution would be to uninstall these hidden network adapters. Although it is easy to right click and uninstall each network adapter, I wanted to create a PowerShell Script to be more efficient. There are no native PowerShell cmdlets or Commands that could help me with this, so after some research I ended with a combination of these two solutions:

I then ended up with the following PowerShell script. The script first get all hidden devices of type Microsoft Hyper-V Network Adapter and their InstanceId. Then for each device uninstall/remove with DevCon.exe. The Script:

Set-Location C:\_Source\DeviceManagement

Import-Module .\Release\DeviceManagement.psd1 -Verbose

# List Hidden Devices

Get-Device -ControlOptions DIGCF_ALLCLASSES | Sort-Object -Property Name | Where-Object {($_.IsPresent -eq $false) -and ($_.Name -like “Microsoft Hyper-V Network Adapter*”) } | ft Name, DriverVersion, DriverProvider, IsPresent, HasProblem, InstanceId -AutoSize

# Get Hidden Hyper-V Net Devices

$hiddenHypVNics = Get-Device -ControlOptions DIGCF_ALLCLASSES | Sort-Object -Property Name | Where-Object {($_.IsPresent -eq $false) -and ($_.Name -like “Microsoft Hyper-V Network Adapter*”) }

# Loop and remove with DevCon.exe

ForEach ($hiddenNic In $hiddenHypVNics) {

$deviceid = “@” + $hiddenNic.InstanceId

.\devcon.exe -r remove $deviceid


And after a while all hidden network adapter devices was uninstalled: In the end I booted the VM and after that everything was working on the network again!

17 thoughts on “Hidden Network Adapters in Azure VM and unable to access network resources

    1. Knave

      Works great for me!

      do note that you must use the correct DevCon.exe version, either x64 or x86 depending on the OS version.

      Use wrongly and it will not work

    1. Jan Vidar Elven Post author

      Hi, just follow the path for downloading WDK 8 (for Windows Server 2012) or WDK 8.1 (for Windows Server 2012 R2), devcon.exe is in the WDK.

  1. Lyubomir Dimitrov

    hey, did you find anyway of getting the hidden adapters for server 2008 R2?
    On the other hand your solution is really cool!

  2. Pingback: Azure VM に RDP 接続が通らず、Ping も応答がない | 一身独立して、一国独立す。

  3. Twan van Beers

    Thanks for this post! It saved me rebuilding our Exchange server in our lab!

    I found a good module https://gallery.technet.microsoft.com/PowerShell-Device-60d73bb0#content which doesn’t have any nasty pre-reqs and, once downloaded and PowerShell execution policy set to RemoteSigned, then the following powershell removes the devices nicely

    get-device -ShowNonpresentPresentDevices -Class GUID_DEVCLASS_NET | ? { $_.IsPresent -eq $False -and $_.Name -like ‘Microsoft Hyper-V Network Adapter*’ } | Uninstall-Device -Confirm:$false


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s