我需要使用WMI获取有关安装在客户端计算机上的间谍软件的信息吗?这可能吗?
答案 0 :(得分:1)
我在丹麦网站Udvikleren.dk上找到了此代码示例,我希望它对您有用。 也可以通过将“AntiSpywareProduct”替换为“AntiVirusProduct”来查找防病毒软件。
uses Windows, WbemScripting_TLB, ActiveX, ComObj;
var
Locator:ISWbemLocator;
Services:ISWbemServices;
ResultSet:ISWbemObjectSet;
Enum :IEnumVariant;
Item :OleVariant;
Value:LongWord;
begin
CoInitializeEx(nil, 0);
CoInitializeSecurity(nil, -1, nil, nil, 0, 3, nil, 0, 0);
Locator:=CoSWbemLocator.Create as ISWbemLocator;
Services:=Locator.ConnectServer('.', 'root\SecurityCenter', '', '', '', '', 0, nil);
ResultSet:=Services.ExecQuery('SELECT * FROM AntiSpywareProduct', 'WQL', wbemFlagReturnImmediately or wbemFlagBidirectional,nil);
Enum:=ResultSet._NewEnum as IEnumVariant;
enum.Reset;
while Enum.Next(1,item,value) = S_OK do
writeln(Item.displayName, '. Enabled: ',Item.productEnabled);
end;