Giter Site home page Giter Site logo

Comments (5)

basictheprogram avatar basictheprogram commented on July 28, 2024

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?

from packer-windows.

StefanScherer avatar StefanScherer commented on July 28, 2024

Thanks for debugging. Maybe we should skip this script for now.

from packer-windows.

StefanScherer avatar StefanScherer commented on July 28, 2024

My latest windows_10 build went through this script without an error.

from packer-windows.

basictheprogram avatar basictheprogram commented on July 28, 2024

Merged in #51 and #58 and now this re-surfaces. I have a PR that fixes the problem for me.

from packer-windows.

StefanScherer avatar StefanScherer commented on July 28, 2024

I‘ve merged #50. Thanks.

from packer-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.