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 🙂
1 2 |
$NIC = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "True"} $NIC.FullDNSRegistrationEnabled |
This works for PowerShell v1 and v2 but in v3 you can do this with a simple oneliner:
1 |
(Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "True"}).FullDNSRegistrationEnabled |
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 🙂
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.
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
An expanded version of the above query – http://blog.danovich.com.au/2013/05/20/powershell-script-to-check-automatic-registration-of-addresses-in-dns/