Wrote a small script to write to my System Event Log and restart my servers
$Server = hostname
New-Eventlog -logname System -source "System Restart"
Write-EventLog -Logname System -source " System Restart" -EntryType Information -EventId 99 -Message "System Restart for Security updates."
Write-EventLog : The source name " System Restart" does not exist on computer “localhost”.
At line:1 char:1
- Write-EventLog -Logname System -source " System Restart" -EntryType I …
-
- CategoryInfo : InvalidOperation: ( [Write-EventLog], InvalidOperationException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteEventLogCommand
I ran this command
[system.diagnostics.eventlog]::SourceExists(“System Restart”)
True
Any Ideas?
Thank you
Tom