If we need to look at the startup history of a service we can find the information in the event log
001
002 003 004 005 006 |
function Get-ServiceStartupHistory {
param ([string]$name ) Get-EventLog -LogName System | where {(($_.EventId -eq 7035) -or ($_.EventId -eq 7036)) -and $_.Message -like “The $($name)*”} } |
I’ve done this as a function as I’m moving all my service based scripts into a module. Eventually, all my scripts will be in modules