tags:

views:

310

answers:

1

Hi All,

I need to get information about the spyware installed on a client machine using WMI? is this possible?

Thanks!

+1  A: 

I found this code sample on a danish site Udvikleren.dk, i hope it's useful to you. Can also be used to find anti-virus by replacing "AntiSpywareProduct" with "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;
Henrik Bierbum Bacher