在搜索答案时,我已经多次看到类似以下的代码示例:
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();
}
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,似乎Windows Server 2008没有SecurityCenter或 …
我正在使用Windows窗体构建一个c#应用程序,它必须检测是否安装,更新和启用了防病毒软件和反间谍软件.我使用WMI.Net完成了这项工作,但我无法找到检查Windows 7是否达到的方法日期.你知道这是否可以通过WMI或任何其他库?
我找到了这个链接:
但是,当我在visual c#express edition 2008中尝试此代码时,它说:
Error 1 The type or namespace name 'ManagementObjectSearcher' could not be found
(are you missing a using directive or an assembly reference?)
C:\Users\Andy\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 15 17 ConsoleApplication1
Run Code Online (Sandbox Code Playgroud)
在2条线上看起来很重要的其他类似错误!
看起来代码段缺少一些导入或什么?
我正在使用Windows 7 ...请帮忙!
安迪
是否有可能以编程方式确定Windows防病毒解决方案是否在Java中是最新的?
我知道我们可以使用 WMI 检索有关已安装的安全应用程序及其状态的信息(如果有),就像链接中的答案1一样。问题是:如何走相反的路?
我的意思是,我正在尝试制作我的个人防病毒软件(我知道,大,巨大,硬,有些人会认为我在开玩笑,我对此感到满意)。我想知道如何将我的软件注册为 Windows 7 防病毒软件?顺便说一句,我正在使用 C#。
可能的重复项:
使用 C# 检测 Windows 上的防病毒软件如何检测是否安装了病毒
扫描程序和/或防火墙?(以及其他一些与安全相关的问题。)
有没有办法在不搜索已知进程的情况下检测当前安装的 av?
有没有办法检测使用C#的机器中是否安装了防病毒软件?我知道安全中心会检测防病毒软件,但是如何在C#中检测到它?以及如何在C#中关闭它?