|
|
Enable DHCP on NICNovember 17, 2004
Author: Shane Boudreaux Description: 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." Else Wscript.Echo "DHCP could not be enabled." End If Next 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.
|
|