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.
 
I understand this way of doing it, and that would not be an issue. But to install I am using WDS, which takes in the boot and install.wim files seperately, so the changes I make for our install.wim are made on the standalone WIM from within NTlite, not to an ISO or source folder. Since it does not run them via setup.exe as normal it would not work to do it in post in this instance

The reason I want to do this is that Windows Setup defaults to "Balanced" and it has been documented for basically anything that does resource intensive tasks from a WinPE (BDR softwares, Windows installations, etc) that changing the power plan to "High Performance" will improve the speed of this process noticeably.

I can shift+f10 to command line on the dialog to see what power plan is set when WDS boots initially; and it is balanced. I am just looking for a way to the default it is using to be changed. I did check the registry as well and it appears WinPE does not have the same registry keys that a normal Windows OS uses.
 
There is no native support for powercfg inside WinPE. I think you're thinking about this trick:
https://automatizeblog.wordpress.co...ndows-deployment-time-using-power-management/

Mount boot.wim from NTLite, right-click to explore the mounted folder and drop in powercfg.exe from the OS distribution. Close window, return to NTLite and export it as WIM. "powercfg /s SCHEME_MIN" is high performance.

Interesting idea, I might try that on my boot image...
 
There is no native support for powercfg inside WinPE. I think you're thinking about this trick:
https://automatizeblog.wordpress.co...ndows-deployment-time-using-power-management/

Mount boot.wim from NTLite, right-click to explore the mounted folder and drop in powercfg.exe from the OS distribution. Close window, return to NTLite and export it as WIM. "powercfg /s SCHEME_MIN" is high performance.

Interesting idea, I might try that on my boot image...
That's odd that it doesnt support it, there is a powercfg.exe present in the boot.wim I pulled from the 21H1 ISO, is that a new thing? I can try changing the command, right now I am trying to determine if the startnet.cmd actually runs or not. It appears that WDS messes with the WIM somewhat, but i'm not 100% sure how yet. I was going to try the winpeshl.ini way if that doesnt work. It'd be cool if NTlite recognized PE specifically and either showed what it was doing and/or let you edit it from the program itself.
 
NTLite doesn't really muck with WinPE, except to add driver support and format drives. Most of it's time is spent on install.wim & post-setup. I don't think 98% of the userbase cares about WinPE scripting, other than it launches Setup.
 
I can shift+f10 to command line on the dialog to see what power plan is set when WDS boots initially; and it is balanced. I am just looking for a way to the default it is using to be changed. I did check the registry as well and it appears WinPE does not have the same registry keys that a normal Windows OS uses.

I found an easy workaround that works for W7 thru 21H1.

W7 boot.wim is missing the ActivePowerScheme key, and W10 calls for balanced plan. Integrate this reg file into your boot.wim & install.wim.
This setting will last through both installation reboots.

If you want a normal power plan after install, throw in "powercfg /s SCHEME_BALANCED" on exit.

Now that I verified this hack, cannot believe how stupidly complicated the original MSFT solution was designed. This requires no scripting...
W7 screen1.jpg
W7 screen2.jpg
W7 screen3.jpgW7 screen4.jpg

W10 screen1.jpg
W10 screen2.jpg
W10 screen3.jpg
W10 screen4.jpg
 

Attachments

  • ActivePowerScheme.reg
    348 bytes
Run this exe (i made it) during setupcomplete or oobe to import and activate ultimate power plan.... also it will remove default power plans...

open the exe via winrar to edit the script if u need to change something.... also u can extract and add it to you script...
 

Attachments

  • Ultimate Performance.rar
    192.8 KB
Awesome, thanks guys I will check both of these out. I am curious to see how they work in my use case, and I agree that the MSFT way of doing this is obtuse and PE scripting in itself is strange. From some testing I did previously I modified the reg key for winpeshl to confirm that it was actually what was launching setup, but for some reason the CMD changes seem to be ignored. I wonder if the winpeshl.ini would be usable as well; but in this case that's unnecessary if the registry changes can just be integrated instead.
 
I understand this way of doing it, and that would not be an issue. But to install I am using WDS, which takes in the boot and install.wim files seperately, so the changes I make for our install.wim are made on the standalone WIM from within NTlite, not to an ISO or source folder. Since it does not run them via setup.exe as normal it would not work to do it in post in this instance

The reason I want to do this is that Windows Setup defaults to "Balanced" and it has been documented for basically anything that does resource intensive tasks from a WinPE (BDR softwares, Windows installations, etc) that changing the power plan to "High Performance" will improve the speed of this process noticeably.

I can shift+f10 to command line on the dialog to see what power plan is set when WDS boots initially; and it is balanced. I am just looking for a way to the default it is using to be changed. I did check the registry as well and it appears WinPE does not have the same registry keys that a normal Windows OS uses.
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.
 
"powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" this doesn't work sometimes. that's why i always import .pow file and activate that.. also guid sometimes changes thats why i always first catch it then use that to activate
 
ege914 Small offtopic. Your Kokteyl.vbs doesn't wait for terminate and you cannot use more parameters on it

This is my invisible.vbs
Code:
' 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

Example
Code:
%WinDir%\System32\wscript.exe //nologo %WinDir%\setup\scripts\invisible.vbs %WinDir%\System32\dism.exe /Online /Add-Package /PackagePath:%%U /quiet /norestart
 
ege914 Small offtopic. Your Kokteyl.vbs doesn't wait for terminate and you cannot use more parameters on it
thank you i'm aware of it doesn't support arguments... i only use it to hide bat and cmd files and don't need arguments. actually i think i got it from here https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way

i think this would support arguments CreateObject("Wscript.Shell").Run "" & WScript.Arguments(0) & "", 0, False

i don't know about "doesn't wait for termination" part. what does it mean exactly?
 
Last edited:
thank you i'm aware of it doesn't support arguments... i only use it to hide bat and cmd files and don't need arguments. actually i think i got it from here https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way

i think this would support arguments CreateObject("Wscript.Shell").Run "" & WScript.Arguments(0) & "", 0, False

i don't know about "doesn't wait for termination" part. what does it mean exactly?
Your VBS support only one argument. During some time I switched to new solution based on idea "Why I need to launch CMD for running DISM executable invisible" etc...

Your VBS launch your CMD script, but in terminates before CMD script is finished.
Code:
https://ss64.com/vb/run.html
 
Your VBS launch your CMD script, but in terminates before CMD script is finished.
Code:
https://ss64.com/vb/run.html
it can't be because i always test my cmd's by adding warning dialog at the end. and dialog always appears. so cmd or bat finishes properly and goes to the end... i'm not experiencing the thing you say

for argument thing, yes you are right but i never use any 1 line command anyway, i could try "" version for arguments
 
Last edited:
Working on this more, it seems that WDS uses the imported boot.wim only on the index 1 portion (i.e. using the PE to load) but then dumps you into their specific windows setup with their menu. I'm trying to see if there's a way to make this work or if I have to just ditch WDS for SCCM or something.
 
Last edited:
it can't be because i always test my cmd's by adding warning dialog at the end. and dialog always appears. so cmd or bat finishes properly and goes to the end... i'm not experiencing the thing you say

for argument thing, yes you are right but i never use any 1 line command anyway, i could try "" version for arguments

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.
 
Back
Top