Editing power plan in boot.wim

autotalon

New Member
Hello, a bit of a head scratcher here. I am trying to edit the boot.wim we use for our WDS server so that the power plan is set to High Performance. In all of the guides online for this assume you are using MDT to create a task sequence manually, but from what I can see this doesnt apply to the way we use it with WDS. I just load the default boot.wim file from an ISO to boot. In this case, how would I edit the power plan? I tried to modify the setupcomplete.cmd in the mount folder when I had winpe mounted, but this does not seem to work. It appears that upon importing to WDS it changes the boot.wim somewhat as there is no longer a windows/setup/scripts folder.

Just wondering if there is a simpler way to do this I'm not aware of.
 
Of course CMD / BAT or whatever app is launched and completed successfully through VBS.

To demostrate issue create more complicated or longer commands - for example Office 2010 installation, then you will find wscript.exe is terminated before setup.exe.

In my case I need to wait until I call another commands etc.
Ok then i switch to your solution thanks for explaining. is it the final version of your vbs?

' Run hidden cmd with arguments
Dim Args()
ReDim Args(WScript.Arguments.Count - 1)

For i = 0 To WScript.Arguments.Count - 1
Args(i) = """" & WScript.Arguments(i) & """"
Next

CreateObject("WScript.Shell").Run Join(Args), 0, True
 
Missing from 7 & 8.1, present in 21H1 boot.wim.
Yes, simply copy powercfg.exe from install.wim\Windows\system32 to boot.wim\Windows\system32 and it will work (Tested under 7). I have tested it now and added it into next POWIS and XP2ESD release as "setup speedup" improvement
 
Last edited:
Windows installation will gain notable speed benefit when high power scheme is activated. For me, there's no going back to the default scheme. Here's how you do it:
  1. Mount boot.wim from command line.
  2. Edit \Windows\System32\startnet.cmd in your mount point by appending line "powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c".
  3. Unmount boot.wim saving changes.
Simple as that! This is a Microsoft documented feature.

startnet.cmd doesn't run when booting Setup, only during WinPE (recovery boot or in managed scenario). Can you confirm the powercfg has taken effect by shift-F10 and running powercfg /l?

Windows PE startup sequence explained
winpe_startup_flowchart.png
 
garlin

1) Mount boot.wim index 2
2) rename sources\setup.exe to launcher.exe
3) rename sources\en-US\setup.exe.mui to launcher.exe.mui - replace en-US with your language
4) add powercfg.exe from install.wim\Windows\system32 into Windows\system32
5) create winpeshl.ini in Windows\system32
Code:
[LaunchApps]
%SYSTEMDRIVE%\Windows\system32\powercfg.exe, /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
%SYSTEMDRIVE%\sources\launcher.exe
6) Unmount and commit boot.wim
 
Here's my walk through of why this registry update works.

Mount boot.wim (2. Windows Setup) inside NTLite, the WinPE registry hive will be imported for you.
Scroll down to HKEY_LOCAL_MACHINE\NLTmp...SYSTEM\ControlSet001\Control\Power\User\PowerSchemes

hive.jpg

W10's ActivePowerScheme for WinPE is set to Balanced. The hive already knows about Power Saver, High Performance and Ultimate plans.
W7 & W8 are missing the ActivePowerScheme key; so defaults to Balanced. There is no Ultimate plan for them.

Solution: Change it to High Performance (8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c) or Ultimate (e9a42b02-d5df-448d-aa00-03f14749eb61).

W7 & W8 don't include powercfg.exe in boot.wim. Like GeorgeKing, I copied it over so we can run powercfg /l during testing. But with a registry key, we don't need the executable to update the power plan.

We also need to insert the same regedit in install.wim. Why? Let's go back to the original article which started the idea:
https://docs.microsoft.com/en-us/ar...indows-deployment-time-using-power-management

There are four phases in running Setup, we want to run High Performance during ALL OF THEM.

1. Boot into WinPE (defaults to Balanced). Running startcmd.net has no effect when it detects Setup.
2. First reboot. Power settings are not persistent across WinPE reboots.
3. Second reboot. Boot into the installed Windows (defaults to Balanced). Integrating the regkey means it boots in the right plan.
4. Run post-setup (SetupComplete, OOBE). You could run a power command as the first line of SetupComplete, but it only applies from here onwards.

Now, how can we test it works? Run install, shift-F10 to open CMD and run powercfg /l (copied over for W7 & 8) across ALL FOUR steps.

The registry file solution is clean, because it doesn't interfere with scripting, either with NTLite, MDT, ADK or whatever. If the registry key doesn't exist in 7 & 8, it will be added. It would appear MSFT could have just done this years ago since the ActivePowerScheme was always there, along with the existing power plans.

W10 doesn't need Ultimate plan imported, it's already there! WinPE powercfg doesn't give it the right friendly name, but finds it. Could you backport it to 7 & 8? I copied it's registry entries into 7, but can't guarantee it actually makes a difference over High since I believe the kernel doesn't recognize it.

If you have a custom power plan, you can apply it during post-setup.
Just remember: always test!
 
Last edited:
1) Mount boot.wim index 2
2) rename sources\setup.exe to launcher.exe
3) rename sources\en-US\setup.exe.mui to launcher.exe.mui - replace en-US with your language
4) add powercfg.exe from install.wim\Windows\system32 into Windows\system32
5) create winpeshl.ini in Windows\system32
Code:
[LaunchApps]
%SYSTEMDRIVE%\Windows\system32\powercfg.exe, /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
%SYSTEMDRIVE%\sources\launcher.exe
6) Unmount and commit boot.wim

I'd agree with experienced users like yourself who do WinPE customization, but it's too much for casual users.
That article on winpeshl.ini gave me a headache to follow :rolleyes:
 
startnet.cmd doesn't run when booting Setup, only during WinPE (recovery boot or in managed scenario). Can you confirm the powercfg has taken effect by shift-F10 and running powercfg /l?

Windows PE startup sequence explained
winpe_startup_flowchart.png
Verified my own advice as you suggested. Indeed, powercfg doesn't do its magic in Windows Setup from boot.wim. The power scheme stays Balanced regardless of startnet.cmd contents. Thanks for clarifying this.
 
ege914 Yes, this is final invisible.vbs that works from XP to 11

btw since your invisible.vbs is not terminated, i discovered this potential problem, lets say;

you run your main.cmd and there is this command wscript.exe invisible.vbs another.cmd
so you want that another.cmd is called from main.cmd and run invisibly via your vbs script and then main.cmd continues to other commands.
but if another.cmd has a loop inside or pause etc, your main.cmd will not continue because your vbs script stayed on and never finished its job.

invisible.vbs can and even maybe should terminate itself before. it won't affect started hidden status as far as i know. i wanted to inform you because i had this exact scenario earlier and had to use my old vbs to complete the action properly.
 
btw since your invisible.vbs is not terminated, i discovered this potential problem, lets say;

you run your main.cmd and there is this command wscript.exe invisible.vbs another.cmd
so you want that another.cmd is called from main.cmd and run invisibly via your vbs script and then main.cmd continues to other commands.
but if another.cmd has a loop inside or pause etc, your main.cmd will not continue because your vbs script stayed on and never finished its job.

invisible.vbs can and even maybe should terminate itself before. it won't affect started hidden status as far as i know. i wanted to inform you because i had this exact scenario earlier and had to use my old vbs to complete the action properly.
Depends on crazy level of your batch process.

I'm always processing thing one by one instead of paralel launching.

Didn't you guys cover this before? If you want non-blocking execution, change bWaitOnReturn:


I'm with George, blocking on exit is a better practice because it allows easier debugging -- only one command is at fault.
Exactly :)
 
This whole conversation helped me immensely in configuring my own Windows image, I really like the ActivePowerScheme registry solution, it is super clean and easy to use, and it speeds up the installation process tremendously if you apply it across all editions in NTLite.

I have a related question though if someone knows the answer:

How would I verify if a certain registry key is or isn't available at a certain stage of the install process?

Specifically, if I were to apply this key across all 4 editions, how do I know if things like WinPE can use it?
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power]
"HiberbootEnabled"=dword:00000000

I can see from testing that all the registry keys inside the path of \Control\Power\ are a part of the powercfg and are in the various editions, but what about this \Control\Session Manager\ path?
 
Last edited:
you can always shift+f10 and type "regedit" to open registry manager to see if your entry is there or not.

-

btw i tested my installation with ultimate performance and verified it was active powerscheme during all installation. it made literally 0 differance in terms of installation speed.... maybe it was because i tested in virtualbox and not real. but still dissapointed
 
How would I verify if a certain registry key is or isn't available at a certain stage of the install process?
Registry keys can be predefined in the image's reg hive, or dynamically created after a package install.
Like the above example, use NTLite and search HKLM\NLTmp...SYSTEM\ for what you're looking for.

Specifically, if I were to apply this key across all 4 editions, how do I know if things like WinPE can use it?
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power]
"HiberbootEnabled"=dword:00000000
WinPE is a stripped down edition of Windows, minus the user apps & extra services. It obeys all normal Windows tweaks.
If you want to install the same power profiles (powercfg or reg key), they all work.

WinPE doesn't hibernate, but if you wanted to save time by using a common profile -- there is no harm.

I can see from testing that all of the registry keys inside the path of \Control\Power\ are a part of the powercfg and are in the various editions, but what about this \Control\Session Manager\ path?
Specific plan details are enumerated in Control\Power
Hibernation and which power plans are currently in effect are enumerated in Control\Session Manager
 
Crypticus, hrm that's odd. Well in my install I am doing it "real", reformatting a Samsung 840 Pro and also a Samsung 850 Evo via Windows Setup and installing fresh, in a non-virtualized environment. One of the reasons I was interested in this power scheme during install is because it seems like perhaps there is a bug in Microsoft at least with some types of drives. I first came across a YouTube video months ago that helped me get around a super slow Windows Install process, the solution was to shift+f10 and change the performance plan during setup. I don't know if it's perhaps a problem with older hardware in general, SSDs, or maybe just older Samsung drives, but there were other people looking for a solution too and this obscure video ended up solving extremely slow installs for us.
 
Back
Top