I'm using the WMI Win32_NetworkAdapterConfiguration Class EnableDHCP Method to enable the DHCP service on a network adapter. I'm using XP Embedded with SP2 but it also happens on my desktop (XP SP3).
Everything works great except when the network cable is unplugged.
If the cable is disconnected, EnableDHCP returns 94 (Path, file, or object not found) and when I look in the network control panel properties, it is set to manual configuration with address 0.0.0.0 and mask 255.0.0.0.
Curiously, when in this state, EnableStatic fails with code 94 or 81 (Unable to configure DHCP service) the first time but then works the second time.
Enabling DHCP works fine using netsh or the windows GUI even with the cable unplugged.
Anybody know how to work around this issue?