Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (28 sloc) 832 Bytes
<#
.SYNOPSIS
Measure Bootup time remotely by rebooting machine and waiting for connectivity through WMI
#>
function Measure-RebootTime {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$ComputerName
)
process {
Try {
$Time = Measure-Command {
Restart-Computer -ComputerName $ComputerName -Wait -For powershell -Timeout 1200 -ErrorAction Stop
} | Select-Object -ExpandProperty TotalSeconds
$RoundedTime = [math]::Round($Time,2)
[PSCustomObject]@{
ComputerName = $ComputerName
Seconds = $RoundedTime
}
}
catch {
Write-Output "$ComputerName failed"
$ErrorMessage = $_.Exception.Message
$ErrorMessage
}
}
}
You can’t perform that action at this time.