Public/Disable-Standby.ps1

function Disable-Standby {
    <#
    .SYNOPSIS
    -Taylor Lee
    Modified 06252019
 
    .DESCRIPTION
    Disables standby, sleep, and hibernate
 
    .EXAMPLE
    Disable-Standby
 
    .Link
    https://github.com/TheTaylorLee/AdminToolbox
    #>

    [CmdletBinding()]
    [Alias("Disable-Sleep")]
    param (
    )
    Write-Host "disabling standby" -ForegroundColor Green
    powercfg.exe -change -standby-timeout-ac 0
    powercfg.exe -change -standby-timeout-dc 0
    powercfg.exe -change -hibernate-timeout-ac 0
    powercfg.exe -change -hibernate-timeout-dc 0
    powercfg.exe -change -monitor-timeout-ac 15
    powercfg.exe -change -monitor-timeout-dc 15
    powercfg.exe -change -disk-timeout-ac 0
    powercfg.exe -change -disk-timeout-dc 0
    #Lid Close do nothing
    powercfg.exe -SETACVALUEINDEX SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 000
    powercfg.exe -SETDCVALUEINDEX SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 000

    #Power Button do Nothing
    powercfg.exe -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 000
    powercfg.exe -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 000
    powercfg.exe -h off
    Remove-Item c:\hiberfile.sys -Force -ErrorAction SilentlyContinue
}