How to write a Startup Script to Add DNS Entries on Client PCs in Domain

Hi Have One Doman Controller and many Client PCs. I had added tow more Additional Domain Controller onto the Network. I want to update these two entries as additional DNS entries on all the client PCs. How to do that via Group Policy?
I want the below commands to be run at clients end when a user logs on :

netsh int ip set dns "local area connection" static 172.30.160.21 primary

netsh int ip add dns "local area connection" 172.30.160.22

netsh int ip add dns "local area connection" 172.30.160.23

These commands would manually add the three IPs as DNS. How do I get this enforced on all the PCs (round 300) whcih are under the same domain.?
pradeepkaravadiAsked:
Who is Participating?
 
oBdAConnect With a Mentor Commented:
You save these three commands in a single text file as startup-DNS.cmd or whatever.cmd in the netlogon folder.
Then you create a new GPO linked to the OU where your client workstations are; in the Security Filtering, you might want to remove Authenticated Users for the time being and add a test workstation until you're sure the command is executed correctly.
Then edit the GPO, and under "*COMPUTER* Configuration\Windows Settings\Scripts", add a new startup script; use \\your.domain.name\netlogon\startup-DNS.cmd as script name, leave the script parameters field empty.
Reboot the test machine, and it should set the DNS servers.
You can *not* run this as logon script; regular users don't have the permissions to change the network configuration.
0
 
Brian PiercePhotographerCommented:
What are you trying to achive?
If you have added additional domain controllers then just add DNS to them (either via the Add/Remove programs, Windows Components, Network Services option, or the configure my server wizard. Assuming you are using AD integrtaed DNS the clients will automatically register themselves in DNS and DNS will automatically replicate to all DNS severs.
0
 
pradeepkaravadiAuthor Commented:
Then what do I do if I want this scirpt to be executed when a "normal" user logs on.
0
 
oBdACommented:
Again: this is nothing that can run on *user* logon; logon scripts run in the user's security context.
This has to be implemented as a *startup* script (this script will be executed with local system permissions) for execution during the computer start as I described above.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.