Using a simple PowerShell cmdlet to remove the DNS registration on Virtual NIC (vNICs) created by Virtual Machine Manager.
This Tutorial was created to remove the DNS Registration of Virtual NICs created using Virtual Machine Manager, however it can be used in several situations where the goal is to remove that flag using PowerShell.
In this scenario we are using a consistent naming convention, as shown in the image below, and all Virtual NICs (all adapters starting with vEthernet) do not require registration in DNS.
However, by default any new adapter on the Operating System will have that option checked on the DNS tab, as shown in the image below.
So, PowerShell to the rescue! Since we have a consistent naming convention and all vNICs shouldn’t have that configuration we can use the following cmdlet to list all vNICs
Now that we tested and we have all of them being listed, we can add the following cmdlet and it will disable registration on all vNICs being listed from the first cmdlet.
Get-NetAdapter vEthernet* | Set-DNSClient –RegisterThisConnectionAddress $False
In order to validate if the operation was performed successfully, we can run the following cmdlet and the value of False should be listed on the RegisterThisConnectionAddress column.
Get-NetAdapter vEthernet* | Get-DNSClient
The result of the three cmdlets above are summarized on the image below.
We can always check the configuration using the Graphical User Interface, and now the setting Register this connection’s address in DNS should be unchecked.
Using this simple cmdlets the administrator can control the DNS registration with a few commands. In environments that do not share a consistent naming convention, the administrator may have to be creative on the Get-NetAdapter cmdlet to list all adapters that are going to configured, or run the same command using the specific name of the adapter several times.