' FILTRO SU ID SISTEMA e RICERCA ULTIMO EVENTO REGISTRATO ShowServicesEvent(6005) Public Function ShowServicesEvent(evcode) strComputer = "." evecode = evcode count = 0 Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colServiceEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventCode = '" & evecode & "'") For Each strEvent in colServiceEvents dtmConvertedDate.Value = strEvent.TimeWritten 'Debug: informazioni mostrate in msgbox (togliere i commenti per la verifica) 'Wscript.Echo dtmConvertedDate.GetVarDate 'Wscript.Echo strEvent.Message count = count + 1 if count <> 0 Then Exit Function End If Next End Function