List of all system modems

Is there a way to list modem / telephony devices installed in the system in managed code? If .Net doesn't have a way, could you please point me in the direction?

+4
source share
2 answers

WMI will contain all the necessary information in the Win32_POTSModem class. In C # or .Net, you can use the System.Management namespace to query WMI.

Inside .Net, you can use MgmtclassGen.EXE from the platform SDK to create a class object that represents the WMI class.

The command line will look like this:

 C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\mgmtclassgen.exe Win32_POTSModem /L CS /P c:\POTSModem\Win32_POTSModem.cs 

and then you can use this in your code:

 using System; using System.Collections.Generic; using System.Management; using ROOT.CIMV2.Win32; public class MyClass { public static void Main() { foreach (POTSModem modem in POTSModem.GetInstances()) { Console.WriteLine(modem.Description); } } } 

The result is as follows:

 ThinkPad Modem - Internal Modem Speed: 56000 

You can also take a look at this article: CodeProject: how: (almost) everything in WMI through C # - part 3: hardware. . The author created a simple class wrapper around WMI objects like MgmtclassGen.exe, but all this is done for you.

+6
source

Just some thoughts for future generations.

@Christopher_G_Lewis provided a very good solution. But before using WMI, we need to check if Windows Management Instrumentation ( WMI , Winmgmt service Winmgmt ) is Winmgmt (how to do this?). Of course, MS recommends not to touch this service, because it is part of the system material, but people sometimes turn it off.

In addition, it can sometimes be useful to check the version of WMI before using it.

If you want to get a list of modems that are currently connected , you can check this solution . It runs slowly, but shows all connected modems and excludes Null modem cables .

+1
source

All Articles