locked
change dns server on desktops without admin privileges RRS feed

  • Question

  • I need to change the dns servers of 300 windows 7 desktops at logon.  I have this script that I am trying to execute via GPO at logon but the users do not have admin privileges.  Is there a way to automatically run this script with admin privileges and set it to run at logon?

    $wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'" 
    $DNSServers = "8.8.8.8","4.2.2.2"  
    $wmi.SetDNSServerSearchOrder($DNSServers)


    Monday, July 29, 2013 9:32 PM

Answers

  • The correct way to do this would be to set up DHCP.

    Bill

    • Proposed as answer by Mike Laughlin Monday, July 29, 2013 10:44 PM
    • Marked as answer by IamMred Tuesday, August 13, 2013 6:56 AM
    Monday, July 29, 2013 9:37 PM
  • Sorry, I don't understand what you're trying to say.

    I think you need to ask about proper DHCP setup in a more appropriate group.

    Bill

    • Marked as answer by IamMred Tuesday, August 13, 2013 6:56 AM
    Monday, July 29, 2013 9:57 PM

All replies

  • The correct way to do this would be to set up DHCP.

    Bill

    • Proposed as answer by Mike Laughlin Monday, July 29, 2013 10:44 PM
    • Marked as answer by IamMred Tuesday, August 13, 2013 6:56 AM
    Monday, July 29, 2013 9:37 PM
  • We have one DHCP server for two domains.  We need to ensure that our primary gets the correct dns and then we can remove the two dns servers that shouldnt be applied to this primary domain.  Unless there is a way to separate DHCP for the trusted domain we have and ensure that all of the computers under "y" domain gets these dns servers and then "x" domain gets this set of dns servers.

    Monday, July 29, 2013 9:52 PM
  • Sorry, I don't understand what you're trying to say.

    I think you need to ask about proper DHCP setup in a more appropriate group.

    Bill

    • Marked as answer by IamMred Tuesday, August 13, 2013 6:56 AM
    Monday, July 29, 2013 9:57 PM
  • As Bill has pointed out;  DHCP servers are designed to handle this.  Just change the scope and the rest will be automatic.  Believe me this works.  I use it very frequently when we alter out domains or change ISPs in non-doman setups.  I also use it to alter the gateway being used when we have multiple ISPs and want to alter traffic.

    Put all DNS on the scope  - both old and new.  When ready remove the old.


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, July 29, 2013 10:28 PM xxxx
    • Proposed as answer by Mike Laughlin Monday, July 29, 2013 10:44 PM
    Monday, July 29, 2013 10:25 PM
  • The DHCP server should be set to follow AD and the workstations should be sub-netted accordingly.  Post in the Networking forum for instructions on the best way to set this up in your network.

    ¯\_(ツ)_/¯

    Monday, July 29, 2013 10:30 PM