I need get Office is Activated or need activation and i use normal query in WMI:
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM " + wmi + " WHERE Name LIKE \"%Office%\" ");
foreach (ManagementObject queryObj in searcher.Get())
{
queryObj["Name"].ToString() + "', '" + queryObj["LicenseStatus"].ToString();
But this query sometimes require 45/50 seconds, now I have to understand how to replace it or speed it up, becasue if i use this command from CMD
WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE LicenseStatus=1 GET Name
It respond in 2 seconds! But i can't integrate CMD in C# only if run external command and from CMD i don't have full query access
This query work:
WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE "name like '%Office%'" Get Name
Now add LicenseStatus=1
WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE "name like '%Office%'" and LicenseStatus=1 Get Name
And query not work, why?