cschneegans / unattend-generator

.NET Core library to create highly customized autounattend.xml files
https://schneegans.de/windows/unattend-generator/
MIT License
659 stars 60 forks source link

ultimate performance power plan and hibernation #2

Closed procionecurioso closed 8 months ago

procionecurioso commented 8 months ago

Hi, I'm not sure it's possible but I'm wondering if it was possible to add to disable windows hibernation, and enable the ultimate performance power plan by default (also set it as default if possible)

cschneegans commented 8 months ago

Consider adding such customizations to the SetupComplete.cmd file:

powercfg.exe /HIBERNATE OFF
powershell.exe -NoProfile -Command "$out=powercfg.exe /DUPLICATESCHEME e9a42b02-d5df-448d-aa00-03f14749eb61;if( $out -match '\s([a-f0-9-]{36})\s'){ powercfg.exe /SETACTIVE $Matches[1];}"

The second commands uses PowerShell to extract the GUID returned by the /DUPLICATESCHEME call using a regular expression.

procionecurioso commented 8 months ago

Thanks for the reply, I'll try it

procionecurioso commented 8 months ago

I tried the bat file alone to see if everything worked, the command to activate the power plan works but the one to disable hibernation doesn't, if I use it alone without the script it works

procionecurioso commented 8 months ago

Ok I solved it was the bat file name too long