Script to uncheck the TCP/IP Settings option for DNS -“Register this connection’s addresses in DNS”

Hello,
I am looking for a script that would first check if this option is checked - “Register this connection’s addresses in DNS”on TCP IP Settings of the servers, and then would clear this checkbox “Register this connection’s addresses in DNS”.  I would like to use input file with the list of servers where to uncheck this option. Please help. Thank you very much.

WE are hosting DNS somewhere else and need to have this option unchecked because registrations are not supported in that DNS. All records are created for the servers ahead of time.
creative555Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Use the below script to accomplish exactly what you need.

Add all of your computer names to a TXT file (one computer name on each like) and change the $IPScheme to whatever you are using.

$IPScheme = "10.10.*"
$Computers = Get-Content "c:\computers.txt"

    ForEach ($Comp in $Computers) 
        {

            $DNSCheck = Get-WmiObject -Class Win32_NetWorkAdapterConfiguration -ComputerName $Comp | ? { $_.IPAddress -like "$IPScheme" }

                If ($DNSCheck.FullDNSRegistrationEnabled -eq $false)
                 {

                    Write-Warning "$Comp DNS setting is already unchecked"

                 }

                else

                 {

                    $DNSCheck.FullDNSRegistrationEnabled
                    $DNSCheck.SetDynamicDNSRegistration($false)

                 }


}

Open in new window


Will.
creative555Author Commented:
Hello Will,
Thank you so much for your answer. I am going to test the script now. One question. Why do we need the IPScheme and can we do without it? I have many servers with different IPs. What does this IPscheme do? I just need to uncheck DNS checkbox.

THank you very much!

$IPScheme = "10.10.*"
Will SzymkowskiSenior Solution ArchitectCommented:
You do not need to use it however it will change this setting on ALL adapters that the machine has. This means all of the IPv6 tunneling adapters etc.

I have modified the script below which only updates the adapters where they have an IPAddress associated with them rather than using the IPScheme.

See below...

$Computers = Get-Content "c:\computers.txt"

    ForEach ($Comp in $Computers) 
        {

            $DNSCheck = Get-WmiObject -Class Win32_NetWorkAdapterConfiguration -ComputerName $Comp | ? { $_.IPAddress -ne $null }

                If ($DNSCheck.FullDNSRegistrationEnabled -eq $false)
                 {

                    Write-Warning "$Comp DNS setting is already unchecked"

                 }

                else

                 {

                    $DNSCheck.FullDNSRegistrationEnabled
                    $DNSCheck.SetDynamicDNSRegistration($false)

                 }


}

Open in new window


Let me know if you have any other questions.

Will.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
creative555Author Commented:
Excellent!! This is the one!! It is working both for local and remote servers. Perfect!! Thank you so much.
Will SzymkowskiSenior Solution ArchitectCommented:
Glad to help!

Will.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.