PowerShell – Is my NIC configured to register in DNS?

Some time ago I got asked how one could find if a network interface card (NIC) is configured to register itself in DNS.
In the GUI it’s a checkbox, a little hidden and you have to click a bit to find it.
The intention was to do an inventory of the environment to see which servers were properly configured.

So, PowerShell to the resque yet again 🙂

This works for PowerShell v1 and v2 but in v3 you can do this with a simple oneliner:

4 comments

  1. Reidar J. Boldevin says:

    In V3 this will suffice:
    (Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object IPEnabled -eq “True”).FullDNSRegistrationEnabled
    Simplifying the Where command. Nice command, it might just come in handy 🙂

  2. Jeff Wouters says:

    Hi Reidar,
    Thanks for your comment, good one.
    Personally I’m still not using the simplified syntax for Where-Object since it only works with one comparison 🙁
    As soon as that’s expanded to multiple statements, I’m switching!
    But that’s a personal thing; your comment is still valid though 🙂
    Jeff.

  3. Hi Jeff

    In V. 2 if there more that one nic this would return nothing:

    $NIC.FullDNSRegistrationEnabled

    You would have to do
    $NIC | Select-Object -ExpandProperty FullDNSRegistrationEnabled
    or
    $NIC | foreach-object { $_.FullDNSRegistrationEnabled}

    For extra shortening you could switch
    $_.IPEnabled -eq “true”
    with
    $_.IPEnabled

    For a final V. 1+2:
    $NIC = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled}
    $NIC | Select-Object -ExpandProperty FullDNSRegistrationEnabled

    If you accept alias’es and you use V. 3 you could get an even shorter version:
    (Get-WmiObject Win32_NetworkAdapterConfiguration | ? IPEnabled).FullDNSRegistrationEnabled

    Thank you for you contribution(s) and I’ll See you in Copenhagen on the PSUG.DK meeting on May the 29th!

    Anders

Leave a Reply

Your email address will not be published. Required fields are marked *