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; } } }
securitycenter2
securitycenter
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)