Pages

Thursday, 15 November 2018

Change laptop power settings

The following PowerShell code was deployed to change the power settings of a number of classroom laptops after they had been rebuilt.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
#Turn off sleep
powercfg.exe -change -standby-timeout-ac 0
Write-Host 'Success - turned off sleep' -ForegroundColor Yellow

#Hibernate after 4 hours
powercfg.exe -change -hibernate-timeout-ac 240
Write-Host 'Success - Hibernate to 4 hours' -ForegroundColor Yellow


#Set close lid to do nothing
$PowerSchemeGUID = "381b4222-f694-41f0-9685-ff5bb260df2e"
$SubgroupGUID = "4f971e89-eebd-4455-a8de-9e59040e7347"
$PowerSettingGUID = "5ca83367-6e45-459f-a27b-476b1d01c936"
powercfg.exe /setacvalueindex $PowerSchemeGUID $SubgroupGUID $PowerSettingGUID 0
powercfg.exe /setdcvalueindex $PowerSchemeGUID $SubgroupGUID $PowerSettingGUID 0
Write-Host 'Success - close lid do nothing' -ForegroundColor Yellow

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Change laptop power settings.ps1

No comments:

Post a comment