我用WMI的时候,就是想不到如何获取这个···怎么弄都无法实现···想了挺久了···也就看见一个VBS的代码,如下strComputer ="."Set Security = Getobject("winmgmts:\\" & strComputer & "\root\SecurityCenter")
Set Viruses = Security.InstancesOf("AntiVirusProduct")
For Each Virus In Viruses
msgbox Virus.displayName
next
好像要在\root\SecurityCenter下获取AntiVirusProduct的值吧
但是就是弄不到····
还希望大家指点一二,谢谢···我实验很多了··一个都没成···
Set Viruses = Security.InstancesOf("AntiVirusProduct")
For Each Virus In Viruses
msgbox Virus.displayName
next
好像要在\root\SecurityCenter下获取AntiVirusProduct的值吧
但是就是弄不到····
还希望大家指点一二,谢谢···我实验很多了··一个都没成···
解决方案 »
- petshop4.0
- 本人现在遇到这样的问题,在程序中涉及到进程的问题 如:Daemon问题,谁有这方面的资料 希望共享一下 本人感激不尽!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- WebBrowser 点击指定位置
- 求助:在c#中能够远程获得机器的物理地址吗
- C#里面中怎样将字符串转为变量名?
- 救命啊:listview中checkboxes点击时我如何知道哪行被选中了?
- 有关远程修改注册表的问题
- 如何用C#获得Explorer进程中的一些行为,比如选中了某个文件
- 在线等待?快?帮帮忙?
- C# frameset
- 1.急求需要能运行出来的完整程序!急啊!
- 再问如何输出Xml文档中Xmltext结点的“text”?花了还几次分类,希望这次药到病除。
//string wmipath = "winmgmts:{impersonationLevel=impersonate}!\\" + computer + "\\root\\SecurityCenter";
string wmipath = @"\\" + computer + @"\root\SecurityCenter";
string antivirusProduct = string.Empty;
ManagementObjectSearcher search = new ManagementObjectSearcher(wmipath + "SELECT * FROM AntivirusProduct");
foreach (ManagementObject o in search.Get())
{
antivirusProduct = o["displayName"].ToString();
}
return antivirusProduct;
//string wmipath = "winmgmts:{impersonationLevel=impersonate}!\\" + computer + "\\root\\SecurityCenter";
string wmipath = @"\\" + computer + @"\root\SecurityCenter";
string antivirusProduct = string.Empty;
ManagementObjectSearcher search = new ManagementObjectSearcher(wmipath,"SELECT * FROM AntivirusProduct");
foreach (ManagementObject o in search.Get())
{
antivirusProduct = o["displayName"].ToString();
}
return antivirusProduct;
ManagementObjectSearcher 需要引用什么?
但是有异常跑出.
search.get() Invalid namespace.
From MSDN:Hi Subash, For your concern how the windows security center recognizes various antivirus softwares installed on your PC, try to refer to the following explanations:Windows Security Center uses a two-tiered approach for detection status. One tier is manual, and the other tier is automatic through Windows Management Instrumentation (WMI). In manual detection mode, Windows Security Center searches for registry keys and files that are provided to Microsoft by independent software manufacturers. These registry keys and files let Windows Security Center detect the status of independent software. In WMI mode, software manufacturers determine their own product status and report that status back to Windows Security Center through a WMI provider. In both modes, Windows Security Center tries to determine whether the following is true: • An antivirus program is present.
• The antivirus signatures are up-to-date.
• Real-time scanning or on-access scanning is turned on for antivirus programs.
• For firewalls, Windows Security Center detects whether a third-party firewall is installed and whether the firewall is turned on or not.
As far as I know, there is no general solution for this. Typically, the developers know the names of antiviruses. So most of the solutions are based on:
1). Identifiying the AV by product name (you can get the list of installed software via Win32_Product or as it was suggested, by installer api). Try to check out this document about Win32_Product class for details - http://msdn2.microsoft.com/en-us/library/aa394378(VS.85).aspx
2). Identifiying the AV by service names Hope this helps,Regards,
到M$网站下一个WMI Tools, 查看一下有没有root\SecurityCenter就可以知道了.
http://www.microsoft.com/downloads/details.aspx?familyid=6430F853-1120-48DB-8CC5-F2ABDC3ED314&displaylang=en
如果用这样传递的参数,就有那个问题了
系统自带好像就有WMI的测试工具,我用过,挺厉害···