void testEvent() { String wql = "SELECT * FROM __InstanceCreationEvent WHERE TargetInstance isa \"Win32_Process\""; wql = "SELECT * FROM __InstanceOperationEvent WITHIN 10 WHERE TargetInstance ISA 'Win32_ComputerSystem' "; wql += " OR TargetInstance ISA 'Win32_OperatingSystem' "; wql += " OR TargetInstance ISA 'Win32_Session' "; wql += " OR TargetInstance ISA 'Win32_LogonSession' "; //wql += " OR TargetInstance ISA 'Win32_NTLogEvent' "; //wql += " OR TargetInstance ISA 'CCM_ComputerSystem' "; //wql += " OR TargetInstance ISA 'CIM_ComputerSystem' "; wql = "SELECT * FROM __InstanceModificationEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_Session\""; EventWatcherAsync watcher = new EventWatcherAsync(wql); //EventWatcherPolling.Run(); }
public static void Main(string[] args) { // start the event watcher EventWatcherAsync eventWatcher = new EventWatcherAsync(); }