Hello together,
I'm working on a simple PS script to gather some event log data from our servers.
(I didn't found a way to realize it with the Event Log Monitor).
Here's the script. (I don't need any statistic data. - Just the message output):
$Output = Get-EventLog -LogName Security -InstanceID 4625 -Newest 100 | Select TimeGenerated, @{Name="UserName";Expression={ $_.ReplacementStrings[5] }}, @{Name="Quellgerät";Expression={ $_.ReplacementStrings[18] }}, @{Name="Quellnetzwerk";Expression={ $_.ReplacementStrings[13] }} | fl TimeGenerated, UserName, Quellgerät, Quellnetzwerk | Out-String;
Write-Host "Statistic: 1";
Write-Host "Message: $Output";
Exit 0
If I run the script on the PS on one of our server it works fine.
Here's an example of the output:
TimeGenerated : 06.05.2019 14:48:46
UserName : xyz.abc@domain.local
Quellgerät : -
Quellnetzwerk : Computer1
TimeGenerated : 06.05.2019 14:48:46
UserName : xyz.abc@domain.local
Quellgerät : -
Quellnetzwerk : Computer1
TimeGenerated : 06.05.2019 14:45:54
UserName : xyz.abc@domain.local
Quellgerät : -
Quellnetzwerk : Computer1
But when I execute it in the template preview it shows the following error message:

Any ideas? Maybe formatting problems?
Thanks,
Tim