Search code examples
devicedevice-manager

script to disable then enable WWAN device


My 3G wireless device is not available after I put my PC to sleep and then wake the PC. In the Connection Manager it says "Device disabled by Device Manager". So I go to the device manager, disable the device, then enable the device. Then the Connection Manager can use it again.

I'd like to disable, then enable the device with some script which I can automatically execute when the PC wakes from sleep or hibernate.

Can this be achieved with a script? My OS is Windows 64bit and it seems that the DevCon command-line utility is not available for 64 bit (except Itanium processors).


Solution

  • Newer versions of the Windows Driver Kit contain a devcon.exe which will run on Windows 7 / 64 bit.

    After making sure devcon.exe was in my PATH (e.g. c:\Windows\System32), I used this command at a DOS prompt to find the hardware ID of my 3G Network Adapter: devcon hwids *usb*

    Then this batch file which I Run As Administrator from the desktop does the job:

    CLS    
    devcon status "USB\VID_03F0&PID_371D"
    @ECHO.
    devcon disable "USB\VID_03F0&PID_371D"
    @ECHO.
    devcon enable "USB\VID_03F0&PID_371D"