In previous videos I demonstrated how to collect Event logs from a Windows server in Azure Log Analytics. You may need to also collect custom logs from applications that don’t log to the event log. In this video I show how to collect custom logs in Azure Log Analytics. Once collected, I also show how to define custom fields in those custom logs and run queries against it. Continue reading “Azure OMS Log Analytics Step by Step – Adding Custom Logs”
As promised, here is the safe restart PowerShell script version that includes writing output to the Event Log.
I used the Write-Eventlog command to get the output into the event log. I started by defining the variables. The eventID and eventSource can be anything, eventLog and eventType need to match the parameters of the Write-Eventlog command.
#eventlog vars $eventLog = "System" $eventType = "Information" $eventID = 212 $eventSource = "SafeRestart"
This is a script that reboots if day and time criteria are met and if the uptime is less than a given number of days.
I had, what I thought, was a simple request. I wanted any servers that had not rebooted as part of the monthly SCCM patch cycle to reboot at the end of the maintenance window. This way I know that the servers don’t have any unfinished patching and the servers have a reboot in the last 30 days. These are Windows servers and I’m old school, I like to routinely reboot them. Continue reading “Safe Restart Script”