Beginning with Windows Vista/Server 2008, you can get rich information about your machine from the new additional application and service logs that are accessible by Get-WinEvent. You should have a look at the function Get-WindowsLaunch. It will tell you not just when your machine was booted, but also how long it took, how long the log-on process took, and how long for startup commands to process!
Note: This function requires Admin privileges to return results so be sure you can run it in a fully elevated PowerShell!
function Get-WindowsLaunch {
$filter = @{
logname='Microsoft-Windows-Diagnostics-Performance/Operational'
id=100
}
Get-WinEvent -FilterHashtable $filter |
ForEach-Object {
$info = 1 | Select-Object Date, Startduration, Autostarts, Logonduration
$info.Date = $_.Properties[1].Value
$info.Startduration = $_.Properties[5].Value
$info.Autostarts = $_.Properties[18].Value
$info.Logonduration = $_.Properties[43].Value
$info
}
}
You can even analyze the data returned by this function. This will retrieve the average, minimum, and maximum boot-up time for your machine:
PS > Get-WindowsLaunch | Measure-Object StartDuration -min -max -Average
Count : 29
Average : 127667,034482759
Sum :
Maximum : 199194
Minimum : 68191
Property : Startduration
ReTweet this Tip!
Posted
Mar 16 2011, 08:00 AM
by
ps1