using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "Company =" + Antivirus("companyName");
label2.Text = "Name =" + Antivirus("displayName");
}
private string Antivirus(string type)
{
string computer = Environment.MachineName;
string wmipath = @"\" + computer + @"rootSecurityCenter";
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmipath,
"SELECT * FROM AntivirusProduct");
ManagementObjectCollection instances = searcher.Get();
//MessageBox.Show(instances.Count.ToString());
foreach (ManagementObject queryObj in instances)
{
return queryObj[type].ToString();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
return null;
}
}
}
Примечание:
Не работает на Windows 7 X64
0.00 (0%) 0 votes











