top of page
Search

(187) Microsoft Intune - Update to Custom Power Plan (Win32)

  • Writer: Mr B SOE way
    Mr B SOE way
  • 3 hours ago
  • 1 min read

Late last year I posted about a 'Custom Power Plan (Win32 app)', I decided to revisit this again.


Create a Power Plan:

ree







Call whatever name you like, in this I have called it 'Devicie Power Plan'

ree








Then customize your power plan as you need.


Start Command Prompt as Administrator, and run the following:

This will list out your current plans:

powercfg /L


ree



Then in the same command prompt, run: powercfg -export "C:\Temp\DeviciePowerPlan.pow" 9044f02c-182b-4a85-955c-567522ab795b


where 9044f02c-182b-4a85-955c-567522ab795b is the Power GUID, replace this with yours.


This will export and give you a file ending in .pow

ree

In prepping the Win32 app:


Create an install.cmd with:


powercfg.exe -import "%~dp0DeviciePowerPlan.pow" 9044f02c-182b-4a85-955c-567522ab795b
powercfg.exe -setactive 9044f02c-182b-4a85-955c-567522ab795b

Create an Install.ps1 with:



    #region Config
    $AppName = "Set Custom Power Plan"
    $client = "CompanyName"
    $logPath = "$env:ProgramData\$client\logs"
    $logFile = "$logPath\$appName.log"
    
    $cmdcommands = ".\Install.cmd"

    #endregion
    #region Logging
    if (!(Test-Path -Path $logPath)) {
        New-Item -Path $logPath -ItemType Directory -Force | Out-Null
    }


    Start-Transcript -Path $logFile -Force

    Start-Process -FilePath "cmd.exe" -ArgumentList "/c `"$cmdcommands`"" -nonewwindow -Wait


     Write-Host "Script completed successfully.."
     Stop-Transcript
     Exit 
 

$Path = "HKLM:\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\9044f02c-182b-4a85-955c-567522ab795b"
$Name = "FriendlyName"
$Type = "EXPANDSTRING"
$Value = "Devicie Power Plan"

Try {
$Registry = Get-ItemProperty -Path $Path -Name $Name -ErrorAction Stop | Select-Object -ExpandProperty $Name
If ($Registry -eq $Value){
Write-Output "Detected"
Exit 0
}
Exit 1
}
Catch {
Exit 1
}

Once the app is packaged, this Win32 app can be added to the ESP. If you plan to pre-provision or go through a normal user driven, you will get this:


ree

 
 
 

Comments


bottom of page