Too many NICs register in DNS – how to remove with Powershell

For those of you (like me) that have decided to move to Hyper-V 2012R2 (the free version, or the core version of Server 2012R2), you may run into this issue. Namely, you have more than one NIC that is registering with DNS. In a full server installation, you would open up the IPv4 properties of the NIC in question, go to the DNS tab, and uncheck the “Register this connection’s addresses in DNS” box. If you’re doing it like me, you have to use powershell. Here’s how I did it:

In Powershell (this is for a remote powershell session, you can skip the first command if you’re logged on to the host machine):

Enter-PSSession –ComputerName SERVERNAME –Credential ADMINUSER

{Enter prompted password}

Get-NetAdapter

Lists all adapters on host.

Get-NetAdapter ADAPTERNAME | Set-DNSClient –RegisterThisConnectionsAddress $False

Turns off the registration, found when right clicking IPV4 settings of an adapter, selecting DNS tab, and it’s the checkbox near the bottom in the GUI.

Get-NetAdapter ADAPTERNAME | Get-DNSClient

Should show “False” under appropriate area.

Finally, in DNS:

Delete the improper IP Address.

And that should do it!

Hyper-V 2012 R2 – No active network adapters found. (!)

This is not the sort of message you want to see…

Scenario: when logging in to a virtual host running Hyper-V 2012 R2 (that’s the free version, so it’s a stripped down version of core) you find this obscure error. The positive of HV2012R2 is that it’s free, it’s clean, it’s lean, and it’s specific. The negative is that your friend google doesn’t have loads of people who have had your same issue, so off you go into Technet land.

First, going to command prompt (at least I was able to remote to this server, which is 100 miles away, and it one of three that have/had this issue) I ran the standby “ipconfig” and I actually had configured network adapters. Since Microsoft has moved everything they can to Powershell, I figured part of the startup was running “Get-NetworkAdapters”. If I clicked on the “ok” in the error message, I got the following:

C:\Windows\System32\en-US\sconfig.vbs(253, 1) (null): 0x80041017

OR

C:\Windows\System32\en-US\sconfig.vbs(1202, 5) (null): 0x8004106C

After digging around in various corners of the internet, I ended up running from command line:

net stop winmgmt

This action stopped the following:

System Center Virtual Machine Management Agent,

Hyper-V Virtual Machine Management,

User Access Logging Service,

IP Helper,

and SMS Agent Host.

It did NOT stop WMI (winmgmt.svc). That’s ok, because this solution worked anyway. Once these all stopped, I ran the following commands:

net start vmms

net start scvmmagent

net start ualsvc

net start iphlpsvc

net start cmmexec

net start winmgmt (NOTE – this one will already be running, but I did it anyway)

After I did the above, to check I ran a simple WMIC command that had previously failed (wmic bios get serialnumber). This now succeeded, so I logged off, then back on – and now sconfig.vbs ran as normal.

Following this, checking with Hyper-V Manager, Failover Cluster Manager, and System Center Virtual Machine Manager showed everything was back to normal.

It’s always nice when you can fix it without a restart.

Helpful links:

Lots of actual names of services here – https://www.windows-commandline.com/start-stop-service-command-line/