How can programmatically check wich version of the WMI (Windows Management Instrumentation) is installed using delphi or C# ?
thanks in advance.
How can programmatically check wich version of the WMI (Windows Management Instrumentation) is installed using delphi or C# ?
thanks in advance.
Try:
using System.Management;
ManagementObjectSearcher query = new
ManagementObjectSearcher("SELECT * FROM Win32_WMISetting") ;
ManagementObjectCollection items = query.Get();
foreach (ManagementObject mo in items)
{
System.Console.WriteLine(mo["BuildVersion"]);
}
There should only be one thing in the items
collection since that setting is a singleton. "BuildVersion" is the WMI version that is installed.
EDIT:
Helen's comment below gives an even more succinct solution:
System.Console.WriteLine(
(new ManagementObject("Win32_WMISetting=@"))["BuildVersion"]);