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

Posted on 2008-11-11
Medium Priority
Last Modified: 2012-05-05
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 primary

netsh int ip add dns "local area connection"

netsh int ip add dns "local area connection"

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.?
Question by:pradeepkaravadi
  • 2
LVL 70

Expert Comment

ID: 22929644
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.
LVL 85

Accepted Solution

oBdA earned 2000 total points
ID: 22929729
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.

Author Comment

ID: 22929773
Then what do I do if I want this scirpt to be executed when a "normal" user logs on.
LVL 85

Expert Comment

ID: 22929820
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.

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question