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

Posted on 2008-11-11
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
    LVL 70

    Expert Comment

    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 82

    Accepted Solution

    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 \\\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

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

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This is my first article in EE and english is not my mother tongue so any comments you have or any corrections you would like to make, please feel free to speak up :) For those of you working with AD, you already are very familiar with the classi…
    Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now