Can I get a Rasdevice's serialport ?

Jul 20, 2011 at 10:26 AM

Hi guys. I wanna match serialport with the Rasdevice, is there any way?

In , I can get the serialports list by My.Computer.Ports.SerialPortNames , and get the Rasdevices by DotRas.Rasdevice.getrasdevices . So I wonder is there someway to get RasDevice by serialport ? Just like DotRas.RasDevice.GetDevicesByType() .


Jul 20, 2011 at 2:25 PM

Unfortunately there is no way of tying a RasDevice instance back to a specific port. The information used by RAS is only the name and type of device it is, as for the rest of the information that's probably stored elsewhere in Windows.

Jul 20, 2011 at 2:45 PM

Like jeff said in several other posts as well getting hardware information is beyond this scope.

I however also needed to know the Serial port that my dial up connection uses. This information is stored in the registry


namely "AttatchedTo" gives you the COM port name.

If you have multiple devices (multiple modems that the same dialer uses) this information is also stored here in incrementing registry entries '0001' '0002' etc

I used this to change the APN as i'm using a dual SIM GPRS modem.

Jul 21, 2011 at 6:38 AM

Thanks for your rapid feedback. It helps me a lot.

It seems that I should try to access the registry.