This commit is contained in:
2024-02-28 14:09:44 -05:00
parent c906da8ee3
commit 71d1b77457
+1 -1
View File
@@ -5,7 +5,7 @@ Function Restart-EndpointOnUptime ([int]$MaxUptimeHours) {
$LastBootUpTime = Get-WmiObject -Class Win32_OperatingSystem1 -ErrorAction Stop | Select-Object -ExpandProperty LastBootUpTime
$LastBootUpTime = [Management.ManagementDateTimeConverter]::ToDateTime($LastBootUpTime)
}
Catch { Write-Error $_.Exception.Message ; Write-Output "Cannot restart this computer" ; Exit }
Catch [Exception] { Write-Error $_.Exception.Message ; Write-Output "Cannot restart this computer" ; Exit }
# Calculate the difference in hours