This is the two easy ways to find start time and stop time for a windows service in PowerShell.
#1: Search within the Windows Event Logs
A new entry is added to the System Event Logs every time the service changes. The script can take some time depending on how big is your Event Logs and the info could have disappeared if it’s too old.
However, you can find the start time with -Message “*LanmanServer*running*” and the stopped time with -Message “*LanmanServer*stopped*”.
(Get-EventLog -LogName "System" -Source "Service Control Manager" -EntryType "Information" -Message "*LanmanServer*running*" -Newest 1).TimeGenerated
#2: Search the start time with the process id
This script is fast but can only find the start time as it is based on a running process.
Get-Process | select name, id, starttime | Select-String (Get-WmiObject -Class Win32_Service -Filter "Name LIKE 'LanmanServer'" | Select-Object -ExpandProperty ProcessId) (Get-WmiObject -Class Win32_Service -Filter "Name LIKE 'LanmanServer'" | Select-Object -ExpandProperty ProcessId)