【问题标题】:Java - Is it possible to programmatically determine if the Windows antivirus solution is up to date?Java - 是否可以以编程方式确定 Windows 防病毒解决方案是否是最新的?
【发布时间】:2012-03-24 02:27:35
【问题描述】:

是否可以通过编程方式确定 Windows 防病毒解决方案在 Java 中是否是最新的?

【问题讨论】:

  • 是的,这是可能的!这是一个简单的任务吗?可能不会。
  • 您是否可以进行系统调用。据我了解,Windows 有一种方法可以让其他程序获得防病毒状态。我想我想知道它是否可能在 Java 应用程序中而不是在 .net 应用程序中
  • 您可能想为此使用 WMI,这里有 an answer on SO for C#。至于如何在Java中做到这一点,有jWMIseveral other approaches
  • 特定的防病毒解决方案或任何?
  • 安装了哪个解决方案。就像 Windows 知道它是最新的一样,我使用的其他程序也使用相同的状态。

标签: java windows antivirus


【解决方案1】:

您可以使用AntiVirusProduct WMI 类的productUptoDate 属性。这里有一些使用示例(在 C# 和 Delphi 中)以及此类的位置(命名空间取决于 Windows 版本)。

要从 Java 访问 WMI 服务,您可以使用 jinteropjWMI

【讨论】:

  • 使用 jWMI,我无法准确找到如何使用此命令查询显示名称:System.out.println(getWMIValue("Select * from AntivirusProduct","displayName"));
【解决方案2】:

这是我们公司以前使用的 VBScript - 它使用 WMI,就像 Niklas B. 的解决方案一样,因此它只能在 XP SP3+ 上运行。它使用与 Windows 安全中心相同的提供程序(它并不总是选择每个 AV 解决方案!但是,确实提供了有关 AV 解决方案的大量信息。

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

祝你好运,编码愉快!

【讨论】:

    猜你喜欢
    • 2016-06-21
    • 1970-01-01
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2010-11-01
    • 2019-01-29
    • 1970-01-01
    • 2010-09-11
    相关资源
    最近更新 更多