I have used the code on the following page in a program I wrote. WMI Tasks: Networking
It works fine in XP but when I tested the code in Vista it doesn't work. For example, the ReleaseDHCPLease function (shown below) returns error code 83 which is "Unable to Release". Every MSDN article I've read regarding this code and the other Win32_Network AdapterConfiguration functions says it works in Vista. What am I missing?![]()
Code:strComputer = "." Set objWMIService = GetObject( _ "winmgmts:\\" & strComputer & "\root\cimv2") Set colNetCards = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration " _ & "Where IPEnabled = True") For Each objNetCard In colNetCards Debug.Print objNetCard.ReleaseDHCPLease Next




Reply With Quote