我在寻找答案时已经看到类似于以下多次的代码示例:
using System;
using System.Text;
using System.Management;
namespace ConsoleApplication1
{
class Program
{
public static bool AntivirusInstalled()
{
string wmipathstr = @"\\" + Environment.MachineName + @"\root\securitycenter";
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmipathstr,"SELECT * FROM AntivirusProduct");
ManagementObjectCollection instances = searcher.Get();
return instances.Count > 0;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
return false;
}
public static void Main(string[] args)
{
bool returnCode = AntivirusInstalled();
Console.WriteLine("Antivirus Installed " + returnCode.ToString());
Console.WriteLine();
Console.Read();
}
}
}
不幸的是,似乎Windows Server 2008没有securitycenter或securitycenter2命名空间,因此在尝试此方法时,我会收到无效的命名空间异常。
有没有人知道如何确定Windows Server 2008上是否有防病毒软件运行?任何帮助是赞赏!
前一段时间我遇到了一个客户端的问题,我最终对本地系统驱动程序和进程进行了一个双向搜索,寻找一个已知的反病毒签名模式(如文件夹名称,进程名称等)不是100%肯定的,因为某个人将会淹没一个全新的反病毒,你不知道,但除此之外,它是非常有效的…