disable hibernation

This commit is contained in:
2020-09-17 15:57:43 -04:00
parent 5694bd0842
commit 4545fcd942
2 changed files with 21 additions and 13 deletions
+8
View File
@@ -42,6 +42,14 @@ If ( IsAdmin )
Write-Output "Deleting all temp files not modified in ${OlderThan} day(s) from ${SysTemp}"
ForEach ( $OldTempFile in $OldTempFiles ) { Remove-Item $OldTempFile -Force -Recurse -ErrorAction SilentlyContinue }
}
## Turn off system hibernation if it's in use
If ( Test-Path "${Env:SystemDrive}\hiberfil.sys" )
{
Write-Output "Turning off system hibernation"
Try { Start-Process "powercfg" -ArgumentList "-h off" -Wait }
Catch { Write-Output $_.Exception.Message }
}
}
## Only run this section if we don't have administrative privileges