?
Solved

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

Posted on 2011-04-29
7
Medium Priority
?
775 Views
Last Modified: 2012-05-11
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".

0
Comment
Question by:oft_iats
  • 4
  • 2
7 Comments
 
LVL 24

Expert Comment

by:Luciano Patrão
ID: 35490766
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
 

Author Comment

by:oft_iats
ID: 35490778
Power shell is a no go for this situation.  Long story.
0
 
LVL 86

Expert Comment

by:oBdA
ID: 35490789
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:oft_iats
ID: 35490876
Am I reading this correctly?  Its looking for devices with DHCP enabled?

None of the interfaces will have DHCP enabled, sorry.
0
 
LVL 86

Accepted Solution

by:
oBdA earned 2000 total points
ID: 35491066
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
 

Author Comment

by:oft_iats
ID: 35491892
<hug>
I am hugging you right now......
......Long period of time goes by.................
</hug>
0
 

Author Comment

by:oft_iats
ID: 36341999
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

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
A few solutions to a problem some of us have been having when trying to add Hostgator email accounts to Outlook 2016 (will probably work with Outlook 2013 as well).
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question