Reputation: 37
Detect Antivirus on Windows using C#
This link tells whether antivirus is installed in the system or not ? Can we code in such a way that we fetch the name of the antivirus installed too?
Upvotes: 1
Views: 600
Reputation: 13456
You need to access wmi displayName
property for each antivirus instance. Use ManagementBaseObject.Properties
string wmipathstr = @"\\" + Environment.MachineName + @"\root\SecurityCenter2";
var searcher = new ManagementObjectSearcher(wmipathstr, "SELECT * FROM AntivirusProduct");
var instances = searcher.Get();
foreach (var instance in instances)
{
Console.WriteLine(instance.GetPropertyValue("displayName"));
}
Upvotes: 1