USB Unplug / Replug Automation
August 28, 2010 3:38 PM   Subscribe

I'm looking for a way to have a windows computer do the equivalent of unpluging and re plugging a usb modem. This system is accessed remotely via Logmein and it is connected to the internet by an external usb evdo modem. The system is located in a third world country and the connection is not reliable. When it goes down, unplugging/replugging sometimes does the trick. How can I make the computer do this on its own?

Ideally I'd like a script or a little exe file that can be called from some automation software (DAQFactory) that is already running on the machine. It uses some proprietary scripting language that I can use to call an EXE in windows and I think it can pass command line arguments also. It might be better if whatever did this worked as a stand alone process independent from the automation software.

I basically need the computer to sense that it is not connected to the internet and reset the modem.

Thanks in advance!
posted by Popcorn to Computers & Internet (8 answers total) 2 users marked this as a favorite
 
Response by poster: The only mechanism that I can think of for doing this is to have windows disable and then re enable the modem. Would this have the same effect as physically unplugging it and plugging it back in? Are device manager functions able to be invoked with code running on the machine rather than user input?

Also, the machine is running Vista.
posted by Popcorn at 3:44 PM on August 28, 2010


Is simply rebooting the system an option?
posted by Threeway Handshake at 4:46 PM on August 28, 2010


If you go into the Device Manager you can locate the USB port connected to the device. You can then disable the port by right-clicking on it. When you disable the port, USB power is removed from the device. Then you can re-enable the port and USB power will be applied to the device. This will reset the USB device the same as if you disconnected and reconnected it.

Perhaps someone else can help with how to do this remotely. You will have to figure out how to identify and point to the correct USB port in the device manager.
posted by JackFlash at 5:21 PM on August 28, 2010


Get a USB hub and plug the modem into the switch.

Plug the USB hub into a remotely operated power strip like http://www.smarthome.com/4415/EcoStrip-2-0-USB-Controlled-Powerstrip/p.aspx
posted by gog at 5:48 PM on August 28, 2010


If possible you should get a different modem for that computer. My favorite is the USR Courier. Uttlery bulletproof.. External with a serial connection. Alternately they have an internal style as a PCI card. You can find these quite cheap on eBay..
posted by dudeman at 7:02 PM on August 28, 2010


Response by poster: I guess rebooting would work, but this is not ideal because it will cause a gap in the computer's offline functioning.

The usb power strip running an external hub is a crafty idea as well, but thats alot of extra parts and I think it leave me in the same position: That strip only cuts the power when the usb port is not getting power. I would still need a way to kill the power at a usb port on the computer.

It's not possible to use a different modem at this point, I'm stuck with this one.

Any other ideas?
posted by Popcorn at 7:48 PM on August 29, 2010


Response by poster: I should add, It's not a telephone modem, its an EVDO modem, the only connection is a male usb plug.
posted by Popcorn at 7:51 PM on August 29, 2010


Best answer: I think what you'll want to do is set up a trigger event on the remote PC for when the system can no longer reach the internet. Microsoft's devcon might be the easiest free solution. You could simply write a batch file like the following to run constantly at startup:


pingloop.bat
---
@echo off
:main
ping www.google.com
if %errorlevel%==0 goto main
start /w devcon disable *nameofmyusbdevice
start /w devcon enable *nameofmyusbdevice
goto main
---
posted by samsara at 8:03 AM on August 30, 2010


« Older Where is this Buddhist Temple?   |   Scheduling Tweets Newer »
This thread is closed to new comments.