IT Management Daily
Storage Daily
Security Daily

follow us on Twitter

Be a Commerce Partner

Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

 DBX to CSV Extractor (DevSlide, Inc.)
 Skype Records (ABTO LLC)
 Orion Network Performance Monitor (SolarWinds)
 FB Limiter (AxiomCoders)
 Keylogger Free Download (Free keylogger download)
 Doremisoft Mac PDF to HTML Converter (Doremisoft Studio)
» Enterprise IT Planet » Resources » Win Scripts

Enable DHCP on NIC

November 17, 2004

Email Print Digg This Add to

Author: Shane Boudreaux
Platform: Windows
Type: Windows Script


This script quickly enables DHCP on your NIC and echoes back whether or not it was successful.

As a network administrator, it is good to have a static IP address at the office. Much easier to use as a TFTP server if the IP is static. With a laptop, however, I've had to go into Network Properties and constantly change to DHCP when I move to different subnets. I wrote this as a quick and easy way of doing just that.

Scroll down to view the script.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Wscript.Echo "DHCP could not be enabled."
End If

Disclaimer: We hope that the information in these pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as - is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by me. I shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

Email Print Digg This Add to

Win Scripts Archives
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers