title: Get DEVPKEY_Device_BusReportedDeviceDesc from Win32_PnPEntity in c#
body: <p>I'm trying to get the bus reported device description from a usb com port in our WPF application. Found a powershell script that gives exacly that, but as not every user has permission to run powershell, so using PowerShell.Create() is sadly not an option.</p>
  <pre><code>(Get-WMIObject Win32_PnPEntity | where {$_.name -match &quot;\(com*&quot;}).GetDeviceProperties(&quot;DEVPKEY_Device_BusReportedDeviceDesc&quot;).DeviceProperties.Data
  </code></pre>
  <p>I have tried below combinations, but I either get &quot;Unable to cast object of type 'System.String' to type 'System.Array'&quot; or &quot;Invalid method Parameter(s)&quot; on InvokeMethod.</p>
  <pre class="lang-cs prettyprint-override"><code>using System;
  using System.Management;
  
  ManagementClass oClass = new ManagementClass(&quot;Win32_PnPEntity&quot;);
  
  Object[] single = { &quot;DEVPKEY_Device_BusReportedDeviceDesc&quot; };
  Array arr = (Array)new string[] { &quot;DEVPKEY_Device_BusReportedDeviceDesc&quot; };
  Object[] singleArr = { single };
  Object[] objsArr = { arr };
  ManagementBaseObject inParams = oClass.GetMethodParameters(&quot;GetDeviceProperties&quot;);
  inParams[&quot;devicePropertyKeys&quot;] = single;
  //inParams[&quot;devicePropertyKeys&quot;] = arr;
  //inParams[&quot;devicePropertyKeys&quot;] = singleArr;
  //inParams[&quot;devicePropertyKeys&quot;] = objsArr;
  
  oClass.InvokeMethod(&quot;GetDeviceProperties&quot;, single);
  //oClass.InvokeMethod(&quot;GetDeviceProperties&quot;, singleArr);
  //oClass.InvokeMethod(&quot;GetDeviceProperties&quot;, objsArr);
  //oClass.InvokeMethod(&quot;GetDeviceProperties&quot;, inParams, null);
  </code></pre>
  <p>Everything takes place on the local machine.</p>
  <p>Also found an answer from vromanov <a href="https://stackoverflow.com/questions/26732291/how-to-get-bus-reported-device-description-using-c-sharp">How to get Bus Reported Device Description using C#</a> and it works, but seems like an overkill solution</p>