无法从XP获得防病毒软件 [英] cant get Antivirus from XP

查看:111
本文介绍了无法从XP获得防病毒软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在系统中获取已安装的防病毒软件的详细信息我可以从Window 7获取详细信息但不能从Windows XP使用以下代码获取数据







I want to get the details of Installed antivirus in system i can get the details from Window 7 but Cant from Windows XP m using below code for fetching data



string wmipathstr = @"\\" + Environment.MachineName + @"\root\SecurityCenter";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmipathstr, "SELECT * FROM AntivirusProduct");
ManagementObjectCollection mObject = searcher.Get();
if (mObject.Count == 0)
{
    wmipathstr = @"\\" + Environment.MachineName + @"\root\SecurityCenter2";
    searcher = new ManagementObjectSearcher(wmipathstr, "SELECT * FROM AntivirusProduct");
    mObject = searcher.Get();
}
if (mObject.Count > 0)
{
    foreach (ManagementObject obj in mObject)
    {
        SysInfo = "insert into [dbo].[AntiVirus]  obj["disName"].ToString() + "','" + obj["instGuid"].ToString() + "','" + obj["SgdPrdctExe"].ToString() + "','" + obj["prdctState"].ToString() + "')";
        break;
    }
}
else
{
    SysInfo = "insert into [dbo].[AntiVirus] [disName]) values('" + MA + 'No AntiVirus')";
}

推荐答案

正如我所看到的,你做对了,虽然决定查询一个或另一个类,应该取决于操作系统版本(参见: http://gallery.technet.microsoft.com/scriptcenter/Get-the-status-of- 4b748f25 )。我没有要测试的XP,但如果操作系统在安全中心正确报告防病毒状态,你应该能够通过WMI获取它。如果安全中心没有正确看到软件,你可以用这种方式得到WMI。我建议你试试 WMI explorer [ ^ ]进入体内,在编码之前。
As I see, you made it right, although the decision to query one or the other class, should depend on the OS version (see: http://gallery.technet.microsoft.com/scriptcenter/Get-the-status-of-4b748f25). I have no XP to test, but if the OS is reporting antivirus status correctly in the security center, you should be able to get it with WMI. If security center does not see the software properly, you can't get it with WMI this way. I suggest you try WMI explorer[^] to get in idea in-vivo, before coding it.


这篇关于无法从XP获得防病毒软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆