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".
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".
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 ...
ASKER
Am I reading this correctly? Its looking for devices with DHCP enabled?
None of the interfaces will have DHCP enabled, sorry.
None of the interfaces will have DHCP enabled, sorry.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<hug>
I am hugging you right now......
......Long period of time goes by.................
</hug>
I am hugging you right now......
......Long period of time goes by.................
</hug>
ASKER
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-exchang e.com/Prog ramming/La nguages/Vi sual_Basic /VB_Script /Q_2724805 9.html
http://www.experts-exchang
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