Posts

Showing posts from February, 2019

Write-EventLog : % 2 output

Image
When using  Write-EventLog to write output to the Operations Manager log you get the weird ": % 2" output like this: Script example: $Healthy = 2625 $Unhealthy = 2626 $Message = "Rule Name: Test Event API Rule`r" $Log = "Operations Manager" $Source = "Health Service Script" $Warning = "Warning" $Information = "Information" Write-EventLog -LogName $Log -Source $Source -EventId $Healthy -EntryType $Information -Message $Message -Category 0 Example: I think it has something to do with the Health Service Script  source expecting 2 parameters. I read somewhere if you add in the -RawData parameter it works but you need to add binary data so not applicable for us. If you register a new source in the ops log like this: Run this: New-EventLog -LogName "Operations Manager" -Source "Event API" Then change this line in the above script: $Source = "Event API" Run it again you'll get this output: Nice and