Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

WMI slow on querying installed products

$
0
0

Hi, I want to use WMI to query which programs are installed. Firstly on the local machine, later also on remote machines, that's why i want to use WMI.

This is the code:

        ManagementScope scope = new ManagementScope(@"\\" + server + @"\root\CIMV2");

        ManagementObjectSearcher mos = new ManagementObjectSearcher(
          scope,new ObjectQuery("SELECT IdentifyingNumber, Name, Version FROM Win32_Product where InstallState = 5 and Vendor = 'Atomia AB'"),new EnumerationOptions() { ReturnImmediately = false});
        ManagementObjectCollection products = mos.Get();

 server is localhost in this case. The query returns 4 rows, i select 3 columns. I'm just wondering why it takes one minute to execute this little piece of code. Is there any way to speed this up?


Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>