WMIC NIC Reports LTE Adapter as Generic Mobile Broadband Adapter

I have a program I wrote in C# that reports on computer hardware and outputs it to a file but I’ve ran into a problem with network adapters.

This is what I’m using:

ManagementObjectSearcher myNetworkObject = new ManagementObjectSearcher("select Name from Win32_NetworkAdapter");
foreach (ManagementObject obj in myNetworkObject.Get())
{
    //conditions to pick the adapter(s) I want.
}

I have a problem with LTE adapters right now. Namely the Intel XXM 7360 LTE-A and Intel XXM 7560 LTE-A Pro. Both report using the above method as Generic Mobile Broadband Adapter.

I need to find a way to identify the name of these adapters. Selecting Name from Win32_NetworkAdapter does not produce the correct name for these adapters.

What I could do is create a special condition within the foreach loop to perform a different operation in the event Generic is found

if (obj["Name"].ToString() == "Generic Mobile Broadband Adapter")
{
    //Perform a different operation if current NIC meets criteria
}

What I don’t know is how can I alternatively acquire the adapter name? Is there a Win32 class for mobile broadband adapters specifically? I tried looking on the Microsoft website but I don’t see one.

I just need to return a string containing the adapter name. I appreciate any leads.

I did a little research into WMIC classes and it looks like no value stored inside Win32_NetworkAdapter contains the string I’m looking for. I did find with netsh wbn show interfaces the string I want exists in the output but I need to find a way to detect and return that value if I start a process and execute cmd.exe with arguments and redirect the output to the executing program.

It looks like I found an adequate solution:

if (string.Contains("Generic"))
{
    Process p = new Process();
    p.StartInfo.FileName = "netsh.exe";
    p.StartInfo.Arguments = "mbn show interfaces";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.Start();

    string output = p.StandardOutput.ReadToEnd();

    if (output.Contains("7360 LTE-A"))
        string[] += ",XMM 7360 LTE-A\"";
    else if (output.Contains("7560 LTE-A"))
        string[] += ",XMM 7560 LTE-A Pro\"";
        
    p.Close();
}

Turns out that was not an adequate solution on multiple operating systems/hardware.

Digging into this problem more it appears that although CMD can reference other programs inside the System32 folder an external compiled application calling CMD inside System32 has problems if the calling program is x64 based.

When starting a process and executing a 32-bit application like CMD or Netsh.exe the program does not execute properly complaining that the arguments are not recognized.

The solution I found was to modify the code to use Wow64FSRedirection

public class Wow64Interop
{
    const string Kernel32dll = "Kernel32.Dll";

    [DllImport(Kernel32dll, EntryPoint = "Wow64DisableWow64FsRedirection")]
    public static extern bool DisableWow64FSRedirection(ref IntPtr ptr);

    [DllImport(Kernel32dll, EntryPoint = "Wow64RevertWow64FsRedirection")]
    public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
}
...
IntPtr wow64Value = IntPtr.Zero;

try
{
    Wow64Interop.DisableWow64FSRedirection(ref wow64Value);

    Process p = new Process();
    p.StartInfo.FileName = "netsh.exe";
    p.StartInfo.Arguments = "mbn show interfaces";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.Start();

    string output = p.StandardOutput.ReadToEnd();

    system[28] = system[28].Remove(system[28].Length - 1);

    if (output.Contains("7360 LTE-A"))
        system[28] += ",XMM 7360 LTE-A\"";
    else if (output.Contains("7560 LTE-A"))
        system[28] += ",XMM 7560 LTE-A Pro\"";
    else if (output.Contains("EM7355"))
        system[28] += ",SIERRA EM7355\"";
    else if (output.Contains("EM7455B"))
        system[28] += ",SIERRA EM7455B\"";
    else if (output.Contains("EM7511"))
        system[28] += ",SIERRA EM7511 X16 LTE-A\"";
    else
        system[28] += output + "\"";

    p.Close();
}
catch (Exception exc)
{
    Console.WriteLine("Unabled to disable/enable WOW64 File System Redirection");
    Console.WriteLine(exc.Message);
    Console.ReadLine();
}
finally
{
    Wow64Interop.Wow64RevertWow64FsRedirection(wow64Value);
}
...

So far this has worked to resolve executing 32-bit applications on a 64-bit compiled program.