if ($aevents = $Wmi->ExecQuery("SELECT * FROM $Win32_Class WHERE LogFile='Application' AND Eventcode=1000")) {