WMI query, Win32_Product but antivirus product not found?

L

Lothar Behrens

Hi,

I am using the code from a tool to create WMI queries. I want to
figure out the version of an antivirus product, but:

The product can't be found. It is installed and listed in the software
installation list (where you usually find installed products).

Why is an antivirus product not found, even I tried running the code
as admin?

The AV product is an older version of Avira (8.x)

Thanks, Lothar

Code:

using System;
using System.Management;
using System.Windows.Forms;

namespace WMISample
{
public class MyWMIQuery
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_Product");

foreach (ManagementObject queryObj in searcher.Get())
{

Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Product instance");

Console.WriteLine("-----------------------------------");
Console.WriteLine("AssignmentType: {0}",
queryObj["AssignmentType"]);
Console.WriteLine("Caption: {0}",
queryObj["Caption"]);
Console.WriteLine("Description: {0}",
queryObj["Description"]);
Console.WriteLine("HelpLink: {0}",
queryObj["HelpLink"]);
Console.WriteLine("HelpTelephone: {0}",
queryObj["HelpTelephone"]);
Console.WriteLine("IdentifyingNumber: {0}",
queryObj["IdentifyingNumber"]);
Console.WriteLine("InstallDate: {0}",
queryObj["InstallDate"]);
Console.WriteLine("InstallDate2: {0}",
queryObj["InstallDate2"]);
Console.WriteLine("InstallLocation: {0}",
queryObj["InstallLocation"]);
Console.WriteLine("InstallSource: {0}",
queryObj["InstallSource"]);
Console.WriteLine("InstallState: {0}",
queryObj["InstallState"]);
Console.WriteLine("Language: {0}",
queryObj["Language"]);
Console.WriteLine("LocalPackage: {0}",
queryObj["LocalPackage"]);
Console.WriteLine("Name: {0}", queryObj["Name"]);
Console.WriteLine("PackageCache: {0}",
queryObj["PackageCache"]);
Console.WriteLine("PackageCode: {0}",
queryObj["PackageCode"]);
Console.WriteLine("PackageName: {0}",
queryObj["PackageName"]);
Console.WriteLine("ProductID: {0}",
queryObj["ProductID"]);
Console.WriteLine("RegCompany: {0}",
queryObj["RegCompany"]);
Console.WriteLine("RegOwner: {0}",
queryObj["RegOwner"]);
Console.WriteLine("SKUNumber: {0}",
queryObj["SKUNumber"]);
Console.WriteLine("Transforms: {0}",
queryObj["Transforms"]);
Console.WriteLine("URLInfoAbout: {0}",
queryObj["URLInfoAbout"]);
Console.WriteLine("URLUpdateInfo: {0}",
queryObj["URLUpdateInfo"]);
Console.WriteLine("Vendor: {0}",
queryObj["Vendor"]);
Console.WriteLine("Version: {0}",
queryObj["Version"]);
Console.WriteLine("WordCount: {0}",
queryObj["WordCount"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for
WMI data: " + e.Message);
}
}
}
}
 
A

Arne Vajhøj

I am using the code from a tool to create WMI queries. I want to
figure out the version of an antivirus product, but:

The product can't be found. It is installed and listed in the software
installation list (where you usually find installed products).

Why is an antivirus product not found, even I tried running the code
as admin?

The AV product is an older version of Avira (8.x)

Most likely because the product has not put the information
in the registry where WMI is looking for it.

Arne
 
Top