what is the methodology for pulling an event at a time...
Basically, I want to pull the most recent 4 or 5 events.
current code:
code:
FUNCTION LISTPROC($COMPUTER,$PROC)
$pidselect="select * from Win32_Process where Name='$PROC'"
$processes=GetObject("winmgmts:{impersonationLevel=impersonate}!//$COMPUTER").ExecQuery("$pidselect")
For each $Process in $processes
?$COMPUTER+ " " +$Process.Name + " is running. PID is " + $Process.ProcessId
Next
$ntbselect="Select * From Win32_NTLogEvent Where SourceName = 'ntbackup'"
$ntbackup =GetObject("winmgmts:{impersonationLevel=impersonate}!//$COMPUTER").ExecQuery("$ntbselect")
For each $event in $ntbackup
$ec=$event.EventIdentifier
$time=$event.TimeGenerated
$year=substr("$time",1,4)
$month=substr("$time",5,2)
$day=substr("$time",7,2)
? "$ec $month/$day/$year"
? $event.Message
Next
? $computer + " " +@serror
ENDFUNCTION