Script to look for NIC's with "Register DNS" enabled

I am looking for a script that will check if "Register in/with DNS" is enabled on more than 1 interface on a computer.  

For example :
ServerA has 3 NIC's.  If only 1 interface has register with dns enabled, do "A" if MORE than 1 interface has register with dns enabled, DO "B".

oft_iatsAsked:
Who is Participating?
 
oBdACommented:
Sorry, total brainfart; need to have my glasses check, I guess.
Try the following; if it doesn't work, please post the output of
netsh interface ip show dns
for a representative machine.
@echo off
setlocal enabledelayedexpansion
set /a DNSRegister = 0
for /f "tokens=2 delims=:" %%a in ('netsh interface ip show dns ^| find /i "suffix"') do (
  for /f "delims= " %%r in ("%%a") do set Result=%%r
  if /i not "!Result!"=="None" set /a DNSRegister += 1
)
echo Interfaces with DNS Registration enabled: %DNSRegister%
if %DNSRegister% EQU 0 (
  echo DNS Registration for all adapters disabled.
  goto :eof
)
if %DNSRegister% EQU 1 goto Do_A
if %DNSRegister% GTR 1 goto Do_B
:Do_A
echo Doing A ...

goto :eof
:Do_B
echo Doing B ...

Open in new window


0
 
Luciano PatrãoICT Senior Infraestructure  Engineer  Commented:
Hi

You can get lots information with powershell scripts.

And you can get lots of examples in the internet to list the properties from Network Adapters.

For this the right flag is SetDynamicDNSRegistration

Check some examples:
http://www.powershellpro.com/powershell-tutorial-introduction/powershell-wmi-methods/

http://poshcode.org/529

http://www.peetersonline.nl/index.php/powershell/gather-nic-properties-including-speed-and-duplex/

Hope this can help

Jail
0
 
oft_iatsAuthor Commented:
Power shell is a no go for this situation.  Long story.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
oBdACommented:
Batch:
@echo off
setlocal enabledelayedexpansion
set /a DHCPEnabled = 0
for /f "tokens=2 delims=:" %%a in ('ipconfig /all ^| find /i "DHCP Enabled"') do (
  for /f "delims= " %%r in ("%%a") do set Result=%%r
  if /i "!Result!"=="Yes" set /a DHCPEnabled += 1
)
echo Interfaces with DHCP enabled: %DHCPEnabled%
if %DHCPEnabled% EQU 0 (
  echo DHCP not enabled, leaving.
  goto :eof
)
if %DHCPEnabled% EQU 1 goto Do_A
if %DHCPEnabled% GTR 1 goto Do_B
:Do_A
echo Doing A ...

goto :eof
:Do_B
echo Doing B ...

Open in new window

0
 
oft_iatsAuthor Commented:
Am I reading this correctly?  Its looking for devices with DHCP enabled?

None of the interfaces will have DHCP enabled, sorry.
0
 
oft_iatsAuthor Commented:
<hug>
I am hugging you right now......
......Long period of time goes by.................
</hug>
0
 
oft_iatsAuthor Commented:
I have expanded the requirements for this script to be IPV6 and IPV4 aware, check it out for a chance at 500 more points.

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27248059.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.