Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sample can be found <a href="http://www.dotnetthoughts.net/2010/09/14/how-to-check-antivirus-installed-using-c/" rel="nofollow">here</a> using WMI as you mentioned. The poster states this is being done on a Win 7 machine; so the code below should get you started...</p> <pre><code>ConnectionOptions _connectionOptions = new ConnectionOptions(); //Not required while checking it in local machine. //For remote machines you need to provide the credentials //options.Username = ""; //options.Password = ""; _connectionOptions.EnablePrivileges = true; _connectionOptions.Impersonation = ImpersonationLevel.Impersonate; //Connecting to SecurityCenter2 node for querying security details ManagementScope _managementScope = new ManagementScope(string.Format("\\\\{0}\\root\\SecurityCenter2", ipAddress), _connectionOptions); _managementScope.Connect(); //Querying ObjectQuery _objectQuery = new ObjectQuery("SELECT * FROM AntivirusProduct"); ManagementObjectSearcher _managementObjectSearcher = new ManagementObjectSearcher(_managementScope, _objectQuery); ManagementObjectCollection _managementObjectCollection = _managementObjectSearcher.Get(); if (_managementObjectCollection.Count &gt; 0) { foreach (ManagementObject item in _managementObjectCollection) { Console.WriteLine(item["displayName"]); //For Kaspersky AntiVirus, I am getting a null reference here. //Console.WriteLine(item["productUptoDate"]); //If the value of ProductState is 266240 or 262144, its an updated one. Console.WriteLine(item["productState"]); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload