Link to home
Start Free TrialLog in
Avatar of gvector1
gvector1

asked on

DNS Change

Is there any way to mass change the DNS values of machines on my domain.  I need to change the DNS values of about 150 machines on my domain.  How can I do this????
Avatar of Rob Williams
Rob Williams
Flag of Canada image

I assume then you are not using DHCP? If so you could do it that way.
If not, one option would be to add the DNS servers using the netsh command, such as shown below, create a startup script, and add to group policy for all the computers to be affected. The catch being that it assumes the network adapter is still named the initial default name.

Primary DNS:
netsh interface ip set dns name = "Local Area Connection" source = static addr = 24.222.1.123
Alternate DNS:
netsh interface ip add dns name = "Local Area Connection" addr = 24.222.2.123
netsh will not work on Windows 2000.  Make sure you're on XP/Vista clients or 2003 servers.
>>"netsh will not work on Windows 2000."
It's on all my systems and not added. See:
http://www.microsoft.com/technet/community/columns/cableguy/cg1101.mspx
Avatar of gvector1
gvector1

ASKER

While trying to give these commands to a remote machine using the -r remotemachinename switch, I keep getting the following message:


WARNING: Could not obtain host information from machine: [gastro2]. Some command
s may not be available.
Access is denied.

The following command was not found: interface ip set dns name = "Local Area Con
nection" source = static addr = 89.89.150.9

The command I gave is below:

netsh -r gastro2 interface ip set dns name = "Local Area Connection" source = static addr = 89.89.150.9

How can I accomplish this remotely one machine at a time and also possibly to all machines on my domain

Disregard my last post asking about all machines on my domain, you answered that in the first post with scripts.  How can I create a script to run for all my domain members?
> It's on all my systems and not added. See:
http://www.microsoft.com/technet/community/columns/cableguy/cg1101.mspx

Learn something new everyday... :)  Thanks!
:-)  AnthonyP9618, I think you are right though, not on any previous versions. Might have been part of the resource kits prior to that. Cheers !

gvector1, to create a script you only need to add those lines to a text file, save as a batch file using a .bat  file extension, and point to it in Group Policy. If saving the script with notepad, or a similar text editor, put the file name in quotes so that it is saved with the appropriate extension, such as "script.bat". Also, save it to a common location such as the NETLOGON share on the server, located:
C:\Windows\SYSVOL\sysvol\<your domain>\scripts
When adding to group Policy best to apply as a start up script, rather than a logon script. With a logon script the user would have to have permissions to change the network configuration. The script is located in:
Computer configuration | Windows Settings | scripts | right click on Startup in the right window | add | pint to your script.
The policy needs to be applied to the OU that contains the computers you wish to change.

Should you want to run it remotely, rather than in the script, I would use the Sysinternals tool psexec:
http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx

There is a little problem.  I am having to change the DNS a bunch of workstations that have a DNS address of a machine that is no longer a Domain Server.  I am getting a message in my event log stating that "windows cannot obtain the domain controller name for my computer's network.  Group Policy processing aborted."  I am changing the DNS of all my machines from one dns to another.  The old DNS has been removed as a domain controller and the new one already set up.  The machines are still getting access to the network, but how can I make it to where they can run the script???
ASKER CERTIFIED SOLUTION
Avatar of Rob Williams
Rob Williams
Flag of Canada image

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
Not currently, but will be working towards it.  Do you know of a way I could export a list of domains computers from the domain controller???
dsquery...
http://www.robvanderwoude.com/adshelp/dsquery_computer.txt

Examples:
To find all computers in the current domain whose name starts with "ms"
and whose description starts with "desktop", and display their DNs:

    dsquery computer domainroot -name ms* -desc desktop*

To find all computers in the organizational unit (OU) given
by ou=sales,dc=micrsoft,dc=com and display their DNs:

    dsquery computer ou=sales,dc=microsoft,dc=com
Can the results be output into a file?
Yes...

dsquery computer ou=sales,dc=microsoft,dc=com > C:\file.txt
You can also open active directory and right click on an OU and choose "Export List"
I will try these suggestions in the morning.  Thanks a million.  I will post the results tomorrow.
Thanks a million guys.  Everything was just what I needed.  I did use another utility for the machine list since dsquery and active directory give a lot more information than just the machine name.  I will accept Rob's post for this solution.  Anthony, I will post another question related to DSQuery for you post on and get the points.

Thanks again,
Kendal
Thanks gvector1. Cheers !
--Rob