Получаем информацию об установленных антивирусных приложениях


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 + @"\root\SecurityCenter";
      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



1 комментарий:

Большая просьба, не писать в комментариях всякую ерунду не по теме!