Enable DHCP

Enables the DHCP client service on a computer. The computer will then use DHCP to obtain an IP address rather than use a static IP address.

5 Star
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
  • Works on Windows 7 prof. 64Bit
    3 Posts | Last post February 02, 2016
    • Works just fine. Thanks
      Must be run as admin.
    • This script will work on Windows 7. It still leaves any statically assigned DNS addresses in place. I prefer to use:
      netsh interface ip set address "Local Area Connection" dhcp
      netsh interface ip set dns "Local Area Connection" dhcp
      This will do both and is targeted at a single network connection.
    • The below command doesn't work for domain users using group policy.May be it require Run as administrator privileges.
      netsh interface ip set dns "Local Area Connection" dhcp 
      Kindly help
  • Admin credentials?
    2 Posts | Last post January 28, 2016
    • This script needs admin privileges? That could be a problem in many orgs where the users are standard users.
      Anyone can confirm?
    • Add this script in gpo as startup script, will work flawlessly
  • Windows 7 & XP
    4 Posts | Last post January 28, 2016
    • Tested on a Server 2008 domain using a Group Policy to apply the script. Tested fine on Windows 7 and XP.
    • Hey thanks for testing, Nick!
    • Doesn' work with Win7 
    • Works on 2012 r2, 8, 8.1
      To change also DNS to DHCP add this in foreach:
      errEnableDNS = objNetAdapter.SetDNSServerSearchOrder(null)