0

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

AstroCB
  • 12,337
  • 20
  • 57
  • 73
StR3aK
  • 9
  • 2

1 Answers1

1

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;