Closed basictheprogram closed 6 years ago
Added some debug
Try {
Write-Output "Set power plan to high performance"
$HighPerf = powercfg -l | %{if($_.contains("High performance")) {$_.split()[3]}}
Write-Output "HighPerf $HighPerf"
$CurrPlan = $(powercfg -getactivescheme).split()[3]
Write-Output "CurrPlan $CurrPlan"
if ($CurrPlan -ne $HighPerf) {powercfg -setactive $HighPerf}
Write-Output "Check and set"
} Catch {
Write-Warning -Message "Unable to set power plan to high performance"
}
And the output
==> virtualbox-iso: Provisioning with powershell script: ./scripts/set-powerplan.ps1
virtualbox-iso: Set power plan to high performance
virtualbox-iso: HighPerf
virtualbox-iso: CurrPlan 381b4222-f694-41f0-9685-ff5bb260df2e
virtualbox-iso: Check and set
virtualbox-iso: Invalid Parameters -- try "/?" for help
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]
==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]
Looks like $HighPerf is not getting set?
Testing interactively
PS C:\Users\Administrator> $HighPerf = powercfg -l | %{if($_.contains("High performance")) {$_.split()[3]}}
PS C:\Users\Administrator> $HighPerf
8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
Command fails when executed over WinRM?
Thanks for debugging. Maybe we should skip this script for now.
My latest windows_10 build went through this script without an error.
Merged in #51 and #58 and now this re-surfaces. I have a PR that fixes the problem for me.
I‘ve merged #50. Thanks.
$ packer --version 1.1.1
macOS 10.12.6