I'm building an advanced function to parse the security log. It seems when I add a 23rd element to my array $list, the script breaks. As long as I stay at 22 or less, it works. Below is the guts of my function:
$list = 4741,4742,4743,4739,4720,4722,4723,4724,4725,4726,4738,4740,4766,4767,4649,4657,4697,4716,4738,4739,4740,4816
#,5148,4776,5149,4625
$events = get-winevent -filterhashtable @{logname="security"; ID = $list}
Foreach ($event in $events) {if ($List -contains $event.id) {$event.timecreated, $event.id, $event.message |
out-file -append c:\sec.txt}}