Automate Windows USB and TCP connections
Using com0com, it's possible to use a batch file to automate the connection. It is even possible to have the batch file run when plugging in the mobile for USB connections! PLEASE BE SURE YOU HAVE BEEN THROUGH THE MANUAL PROCEDURE AND HAVE IT WORKING BEFORE EXECUTING THIS PROCEDURE. You can find the com0com setup here: com0com setup .
Check for a 2003 event (during plug in) and 2102 event (during unplug) and look at the USB instance. In the XML view, this will will show under UserData, UMDFHostDevice.