Hi Scripting Experts,
I'm trying to write a script to log Domain Logon Failures, rather than
trawling thru our DCs logs. For the moment I'm happy with getting
output, rather than just logging to a file.
So far I have is the following which outputs the number of Domain
Logon Failures as indicated by Event ID 675.
My question - how do I go about extracting the username and time the
event was logged? Scripomatic doesn't seem to mention this for the
Win32_NTLogEvent collection. Here's my script so far, help much
appreciated.
'VBScript to check the Security Log for Logon Faillures
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'Security' and " _
& "EventCode = '675'")
Wscript.Echo "Domain Logon Failures: " & colLoggedEvents.Count