Is it possible to programmatically determine if the Windows antivirus solution is up to date within Java?
Java - Is it possible to programmatically determine if the Windows antivirus solution is up to date?
Asked
Active
Viewed 1,649 times
5
-
2Yes, that's possible! Is it a simple task? Probably not. – Niklas B. Mar 24 '12 at 02:30
-
Is there maybe a systems call you can make. From what I understand windows has a way of allowing other programs to get the antivirus status. I guess I'm wondering if it's possible within a Java app versus say a .net app – Stephane Grenier Mar 24 '12 at 02:31
-
You might want to use WMI for that, there's [an answer on SO for C#](http://stackoverflow.com/a/1331918/916657). As for how to do this in Java, there's [jWMI](http://henryranch.net/software/jwmi-query-windows-wmi-from-java/) and [several other approaches](http://stackoverflow.com/a/4638004/916657). – Niklas B. Mar 24 '12 at 02:34
-
A specific antivirus solution or any? – Ryan Kempt Mar 24 '12 at 02:34
-
Whichever solution is installed. The same way Windows know it's up to date and other programs I've use that same status. – Stephane Grenier Mar 24 '12 at 02:41
2 Answers
7
You can use the productUptoDate
property of the AntiVirusProduct
WMI Class. Here you have some samples (in C# and Delphi) of use and the location(the namespace depends of the Windows version) of such class.
Detect Antivirus on Windows using C#
- Getting the installed Antivirus, AntiSpyware and Firewall software using Delphi and the WMI
for access th WMI service from Java you can use jinterop
or jWMI
-
Using the jWMI, i can't find exactly how to query the display name with this command : System.out.println(getWMIValue("Select * from AntivirusProduct","displayName")); – imanis_tn Apr 23 '12 at 14:59
2
This is a VBScript our company used to use - it uses WMI as Niklas B.'s solution does as well, so it will only work on XP SP3+. It uses the same provider as Windows Security Center (which doesn't always pick up every AV solution! However, does provide a lot of information on the AV solution.
Set objSWbemServices = GetObject("winmgmts:\\.\root\SecurityCenter")
Set colFirewall = objSWbemServices.ExecQuery("Select * From antivirusProduct",,48)
For Each objAntiVirusProduct In colFirewall
WScript.Echo "companyName: " & objAntiVirusProduct.companyName
WScript.Echo "displayName: " & objAntiVirusProduct.displayName
WScript.Echo "instanceGuid: " & objAntiVirusProduct.instanceGuid
WScript.Echo "onAccessScanningEnabled: " & objAntiVirusProduct.onAccessScanningEnabled
WScript.Echo "productUptoDate: " & objAntiVirusProduct.productUptoDate
WScript.Echo "versionNumber: " & objAntiVirusProduct.versionNumber
Next
Best of luck and happy coding!

Ryan Kempt
- 4,200
- 6
- 30
- 41