Link to home
Start Free TrialLog in
Avatar of oft_iats
oft_iats

asked on

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".

Avatar of Luciano Patrão
Luciano Patrão
Flag of Portugal image

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
Avatar of oft_iats
oft_iats

ASKER

Power shell is a no go for this situation.  Long story.
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

Am I reading this correctly?  Its looking for devices with DHCP enabled?

None of the interfaces will have DHCP enabled, sorry.
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<hug>
I am hugging you right now......
......Long period of time goes by.................
</hug>
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