How to add dns record only to computers with static ip excluding dhcp computers via gpo

Fabrizio Ramos 1 Reputation point
2020-11-24T20:45:02.333+00:00

Hello everyone

I need to modify the dns registers via gpo only to the computers that have a static ip excluding the computers that are found via DHCP.
It must be in the following order
First: IP 1.1.1.1
Second: IP 1.2.3.4
Third: IP 2.2.2.2

Current Scenario:
First: IP 1.2.3.4
Second: IP 2.2.2.2

thanks

Windows for business Windows Client for IT Pros Directory services Active Directory
Windows for business Windows Client for IT Pros Networking Network connectivity and file sharing
Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Thameur-BOURBITA 36,261 Reputation points Moderator
    2020-11-25T00:25:17.68+00:00

    HI,

    There is a GPO setting to specify DNS resolver:

    42345-image.png

    please don't forget to mark this reply as answer if it help you to fix your issue


  2. Anonymous
    2020-11-25T02:40:47.753+00:00

    Hi ,

    Based on my understanding, you want to modify DNS server via GPO only for those static IP computers. You don't want to modify DNS server for DHCP-assigned computers. Is that right? Please feel free to let me know if my understanding is wrong.

    Group policies can assigned to the Active Directory organizational unit (OU) in which the computer or user are placed. So if my understanding is right, you can divide those static IP computers into a separate OU in advance and push the GPO settings.

    If your static IP computers and DHCP-assigned computers are in the same OU, then you could split static IP computers into a different security group. Add the specified security group and only give this security group read and apply group policy permission. Then GPO settings will only apply to this specified security group.

    42353-image.png

    For how to set DNS servers via GPO, you can refer to the following article:

    Set DNS servers via GPO Server 2012 R2

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Fabrizio Ramos 1 Reputation point
    2020-11-25T15:50:19.603+00:00

    Hi,

    there is no way to do it via command or script to all user computers excluding dhcp computers?

    thanks

    0 comments No comments

  4. Anonymous
    2020-11-26T01:17:02.557+00:00

    Hi ,

    there is no way to do it via command or script to all user computers excluding dhcp computers?

    There is no simple command can achieve your goal. Since I am not an expert in scripting, I am not sure whether you can do it via script. You might need to write a complex script.

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  5. Evgenij Smirnov 541 Reputation points
    2020-11-26T20:07:27.69+00:00

    You sure can. Run on each computer (locally or remotely)

    Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE | Where-Object {!$_.DHCPEnabled} | ForEach-Object { $_.SetDNSServerSearchOrder('8.8.8.8','8.8.8.4')}
    

    or something along these lines.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.