Post-Installation Question on reg files

tistou77

Member
Hi

I have a small question with the Post-installation
I have a .bat file, which points to several .reg files
I wanted to integrate this bat file into the Post Installation, but when it will be executed after the installation, the linked reg files will not be applied

A solution for these reg files to be applied ?

Thanks
 
Yes, you should find the data in the key HKEY_USERS\.Default
You should use logon commands to work the way you want.
I have these registry keys in the reg file and it works fine
It's different in the bat file?

Use call instead of only runing the batch file and at the end of every script add exit /b, inside every batch file. When you use the call command setupcomplete batch pauses until the batch file called ends.

If setup directory gets deleted, setupcomplete.cmd is deleted, at the end of the setup a file named state.ini is created State folder, inside the Setup folder.
Script folder and it's contents is deleted once setupcomplete.cmd finishes, check the last line in setupcomplete.cmd once the process has finished, there will be the command that deletes the script folder, not seen in the Post Setup page.
I will test with exit / b at the end of each bat file

Call is not specified in NTLite but is specified for each bat file in SetupComplete.cmd

@echo off
powercfg -h off
net accounts /maxpwage:unlimited
call "%WINDIR%\Setup\Files\Divers_10.bat"
call "%WINDIR%\Setup\Files\Edge.bat"
call "%WINDIR%\Setup\Files\IE.bat"
call "%WINDIR%\Setup\Files\Offline.bat"
rd /q /s "%WINDIR%\Setup\Files"
del /q /f "%0"

Thanks ;)
 
Try to log your "batches", add these first lines on each:

Code:
echo off
set df=%systemdrive%\Users\Public\Desktop
set bf1=%sl%\bf1.txt
echo.>%bf1%
echo %time%>>%bf1%

call :LOG >> %bf1%
exit /B

:LOG

::Here goes the batch content.::

You can use the command "echo %time%>>%bf1%" to know when the script has run or between lines to know how long lasted running each command.

df stands for desktop folder and bf stands for batch file.
 
Thanks so much for your help ;)

I do a last test, I wanted to go through NTLite so that it applied automatically after the installation, but with all these tests, it starts to be longer than just clicking on the batch once I'm on the desktop, after Installation :D :D
 
I do a last test, I wanted to go through NTLite so that it applied automatically after the installation, but with all these tests, it starts to be longer than just clicking on the batch once I'm on the desktop, after Installation :D:D

Use FirstLogonCommads (synchronouscommand) instead:


Should be ok.
 
it's added to the autounattend file ?

Otherwise I tried with that in the SetupComplete file but without success

@echo off
powercfg -h off
net accounts /maxpwage:unlimited
regedit.exe /s E:\Win10\Divers_10.reg
regedit.exe /s E:\Win10\Edge.reg
regedit.exe /s E:\Win10\IE.reg
rd /q /s "%WINDIR%\Setup\Files"
del /q /f "%0"
 
it's added to the autounattend file ?
Yes, the documentation shows where to put the command.
Code:
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture=".....................>
   <FirstLogonCommands>
      <SynchronousCommand wcm:action="add">
         <CommandLine>c:\synccommands\command1.cmd</CommandLine>
         <Description>Description_of_command1</Description>
         <Order>1</Order>
      </SynchronousCommand>
      <SynchronousCommand wcm:action="add">
         <CommandLine>c:\synccommands\command2.exe</CommandLine>
         <Description>Description_of_command2</Description>
         <Order>2</Order>
      </SynchronousCommand>
    </FirstLogonCommands>
  </component>
</settings>
SynchronousCommand now runs as AsynchronousCommand, all commands run at the same time.

Otherwise I tried with that in the SetupComplete file but without success
I'm testing batch files on setup and i have found something interesting:
I had to add timeout (up to 55), otherwise, these commands shows errors (i'm always logging).

@echo off
powercfg -h off
net accounts /maxpwage:unlimited
regedit.exe /s E:\Win10\Divers_10.reg
regedit.exe /s E:\Win10\Edge.reg
regedit.exe /s E:\Win10\IE.reg
rd /q /s "%WINDIR%\Setup\Files"
del /q /f "%0"

Try adding 2 seconds timeout between lines but 5 after net accounts
 
Last edited:
Hi

So, I tried this (with and without /t for timeout) and it does not work

@echo off
powercfg -h off
net accounts /maxpwage:unlimited
timeout /t 5
regedit.exe /s E:\Win10\Divers_10.reg
timeout /t 2
regedit.exe /s E:\Win10\Edge.reg
timeout /t 2
regedit.exe /s E:\Win10\IE.reg
timeout /t 2
regedit.exe /s E:\Offline.reg
del /q /f "%0"

Nevermind, I'll continue as before

Thanks anyway for your help
 
Weird
I use the oobe.cmd and have the command "net accounts /maxpwage:unlimited" in it and is working.
 
It's good with this

@echo off
powercfg -h off
net accounts /maxpwage:unlimited
del /q /f "%0"

Only with files added does not work
 
Will there be a command to create a file that will indicate the errors ?
I use wintee, more info:

This is the code i use in oobe.cmd, the oobs.cmd batch file contains all the commands.
Code:
@echo off
set ob=%systemdrive%\Users\Public\Desktop\oobe.txt
set sf=%Windir%\Setup\scripts
echo.>>%ob%
call %sf%\oobs.cmd 2>&1 | wtee %ob%
echo.>>%ob%
echo.>>%ob%

Only download the (wintee) file and copy to "sources\$OEM$\$$\System32"
 
Last edited:
All good things comes to those who wait. :) Hmm, i need to get that into the bat's themselves because they must run elevated with PR. Will fiddle.
 
Last edited:
I know you can put them anywhere in the image, but is "%WINDIR%\Setup\Files" the best/most logical place to put any batch/powershell script/exe/installer files that you want to execute post install ?
 
I know you can put them anywhere in the image, but is "%WINDIR%\Setup\Files" the best/most logical place to put any batch/powershell script/exe/installer files that you want to execute post install ?
The best is to call it/launch it right.
 
Back
Top