Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable DHCPINFORM on Windows 2000, 2003, XP, Vista, 7
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT Name,DeviceID FROM Win32_NetworkAdapter WHERE NetConnectionStatus=2", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
strName = objItem.Name
Set colNicConfigs = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_NetworkAdapter.DeviceID='" & objItem.DeviceID & "'} WHERE AssocClass=Win32_NetworkAdapterSetting")
For Each objItemConfig In colNicConfigs
strSettingID = objItemConfig.SettingID
Next
Set wshShell = CreateObject( "WScript.Shell" )
wshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & strSettingID & "\UseInform",0,"REG_DWORD"
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.