TUTORIAL: Create perfect Windows Post-Setup using OOBE.cmd

This seems like OOBE.cmd is ignored by Windows setup. This need to force inject it into RunOnce in offline mounted registry. I will prepare script that will automatically add it into all images.

Or you can integrate attached registry file into image using Registry page in NTLite as this is most comfortable way

WARNING for other users: Use this registry only when OOBE.cmd doesn't work for you!
Hi George,
I added your Reg as per suggested, but what I found out is that if I used it with the combinate of Autorun.dll patcher it not work, but if I use it without Autorun.dll patcher it install Office and other application fine.
thanks
Dimand
 
Hi George,
I added your Reg as per suggested, but what I found out is that if I used it with the combinate of Autorun.dll patcher it not work, but if I use it without Autorun.dll patcher it install Office and other application fine.
thanks
Dimand
Hmmm, thats weird as I'm using both combined without problem
 
Thank you so much for all your knowledge that you share with us. I'm playing around with it a bit right now.
Is it possible to change the blue Windows 10 post setup to the classic menu as you show in your screenshot?
I would like to see more details.
 

Attachments

  • 2021-01-04 16_27_08-Windows 10 x64 - VMware Workstation.jpg
    2021-01-04 16_27_08-Windows 10 x64 - VMware Workstation.jpg
    60 KB
Do you mean to kill OOBE? I don't know what Microsoft changes in Windows 10. Will review it soon. On my real machine was show menu from picture, but it takes really too long on OOBE finishing, if you mean this?
 
Sorry for my mistake, yes you are right. OOBE takes a long time, but the Windows Post-Setup now appears correctly!
 
I want to run a Powershell Script with privileges like installing Chocolatey. But this isnt working, to put the file install-choco.ps1 under %DRIVE%\Setup\

install-choco.ps1
C#:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Do you have an Idea?
 
I really wish there was a video with step by steps on how to create these items.
I really want to pull the trigger and buy the license to make a great image for my work.
 
I found a small mistake in your Script, it should be %%~nC instead of %%~nU and %%C instead of %%U

Here is the correct extract from your MSI Installation Part:
Code:
    REM Auto-install %ARCH% depend MSI packages
    IF EXIST "%DRIVE%\setup\*-%ARCH%.msi" (
        REG ADD %ROE%\003 /ve /d %MSITEXT% /f

        FOR %%C IN ("%DRIVE%\setup\*-%ARCH%.msi") DO (
            REM Get Installer
            FOR /F "tokens=1 delims=-" %%G IN ("%%~nC") DO (
                REM Get Switch
                if exist "%DRIVE%\setup\%%G.txt" (
                    for /F "usebackq tokens=*" %%A in ("%DRIVE%\setup\%%G.txt") do (
                        REG ADD %ROE%\003 /v "%%~nC" /d "%%C %%A" /f
                    )
                ) else (
                    REG ADD %ROE%\003 /v "%%~nC" /d "msiexec /i %%C /quiet /norestart" /f
                )
            )
        )
    )


    REM Auto-install %ARCH% independent MSI packages
    IF EXIST "%DRIVE%\setup\*-all.msi" (
        REG ADD %ROE%\003 /ve /d %MSITEXT% /f

        FOR %%C IN ("%DRIVE%\setup\*-all.msi") DO (
            REM Get Installer
            FOR /F "tokens=1 delims=-" %%G IN ("%%~nC") DO (
                REM Get Switch
                if exist "%DRIVE%\setup\%%G.txt" (
                    for /F "usebackq tokens=*" %%A in ("%DRIVE%\setup\%%G.txt") do (
                        REG ADD %ROE%\003 /v "%%~nC" /d "%%C %%A" /f
                    )
                ) else (
                    REG ADD %ROE%\003 /v "%%~nC" /d "msiexec /i %%C /quiet /norestart" /f
                )
            )
        )
    )
 
I'm not sure is it the correct thread to ask for, but I have a problem to activate a Windows 10 Prof OEM Key.
Im using you Activation.cmd and your instructions to add the following lines in the oobe.cmd:
Code:
REM Remove generic installation product key

REM Uninstall the current product key from Windows and put it into an unlicensed state
"%WinDir%\System32\cscript.exe" /Nologo "%WinDir%\System32\slmgr.vbs" /upk

REM Remove the product key from the registry if it's still there
"%WinDir%\System32\cscript.exe" /Nologo "%WinDir%\System32\slmgr.vbs" /cpky

REM Reset Windows Activation
"%WinDir%\System32\cscript.exe" /Nologo "%WinDir%\System32\slmgr.vbs" /rearm

My Activation.cmd
Code:
@ECHO OFF

FOR %%I IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%I:\sources\install.esd SET DRIVE=%%I:
IF "%DRIVE%" == "" FOR %%I IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%I:\sources\install.wim SET DRIVE=%%I:
IF "%DRIVE%" == "" FOR %%I IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%I:\sources\install.swm SET DRIVE=%%I:


Title Windows Activation

@echo  **********     Activate Windows 10 OEM Key from BIOS     ***********

REM @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File "%DRIVE%\support\WindowsSetOEMProductKey.ps1" -activate


and here the Powershellscript:


The funny part is, that it is working after deploying, if im starting the Activation.cmd manually.

Has anyone an Idea to fix the Problem? I tried a lot of things
 
George,
I have download Office365 Enterprise download using XML file, but when using YAOCTRI when activating license (Sign In) it pick up Mondo edition not the one I get via my subscription. when looking at your YAOCTRI_Installer.cmd, there are some line which set to MondoVolume. is it possible to keep the same edition as per my subscription? in this case i'm using Office365 Enterprise.
1611213672984.png
thanks
Dimand
 
George,
I have download Office365 Enterprise download using XML file, but when using YAOCTRI when activating license (Sign In) it pick up Mondo edition not the one I get via my subscription. when looking at your YAOCTRI_Installer.cmd, there are some line which set to MondoVolume. is it possible to keep the same edition as per my subscription? in this case i'm using Office365 Enterprise.
View attachment 4415
thanks
Dimand
Hi dimand
have you followed instructions and read "Behind the scenes"?

Code:
[LIST]
[*]YAOCTRI - Volume flavor:
[*]Microsoft 365 Enterprise will be installed as Retail SKU, then converted with Mondo 2016 Volume licenses
additionally, O365ProPlusRetail grace key will be installed to enable more features
[*]On Windows 10:
all other products will be installed directly as Volume SKUs
[*]On Windows 7/8.1:
Office Mondo 2016 will be installed directly as Volume SKU
all other products will be installed as Office 2016 Retail SKUs, then converted with Office 2019 Volume licenses
[*]YAOCTRIR - Retail flavor:
[*]On Windows 10:
all products will be installed directly as Retail SKUs
[*]On Windows 7/8.1:
all Microsoft 365 and Office 2016 products will be installed directly as Retail SKUs
Office 2019 products will be installed as Office 2016 Retail SKUs, then converted with Office 2019 Retail licenses
[/LIST]

From provided infortion from you, I quess you need to use YAOCTRIR
 
Sorry but this is crazy, the first post is like 10 pages long and extremely unclear. The only thing I want to do is run a single command after the user logs on, nothing else. Why is there 5,000 words about installing Microsoft Office?
 
Last edited:
The whole thing is unclear, there are no proper sections or step numbers, it's not clear which steps are necessary and which are not, and the poor English really doesn't help either.
I've run it, it did not execute my setup file, instead gave me an unrelated error about updater.exe.

As I've said, all I want to do is run one file (or actually 2, but 1 would be a great start).
 
Can someone help me with a cmd prompt for the Unattended section.
I want to set the class id and release and renew the IP, i want to see if this works so i can then make it that it joins the domain by itself.

Thanks
 
This seems like OOBE.cmd is ignored by Windows setup. This need to force inject it into RunOnce in offline mounted registry. I will prepare script that will automatically add it into all images.

Or you can integrate attached registry file into image using Registry page in NTLite as this is most comfortable way

WARNING for other users: Use this registry only when OOBE.cmd doesn't work for you!

Your OOBE.cmd adds to RunOnceEx, right?

Are all the HKLM\RunOnce commands executed before the HKLM\RunOnceEx commands are executed?

If not, wouldn't that registry file break the script?

UPDATE:

I've done further testing. After applying the following reg file:


Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKLM-Run\" >>C:\\setup.log"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKLM-RunOnce\" >>C:\\setup.log"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\01]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKLM-RunOnceEx\" >>C:\\setup.log"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKCU-Run\" >>C:\\setup.log"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKCU-RunOnce\" >>C:\\setup.log"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\01]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKCU-RunOnceEx\" >>C:\\setup.log"

The output to the setup.log was the following after restarting twice:

Code:
Fri 02/05/2021 13:43:45.50: HKLM-RunOnceEx
Fri 02/05/2021 13:43:45.57: HKCU-RunOnceEx
Fri 02/05/2021 13:43:45.66: HKLM-RunOnce
Fri 02/05/2021 13:43:56.77: HKLM-Run
Fri 02/05/2021 13:43:57.75: HKCU-Run
Fri 02/05/2021 13:43:57.80: HKCU-RunOnce

Fri 02/05/2021 13:46:23.28: HKLM-RunOnceEx
Fri 02/05/2021 13:46:23.35: HKCU-RunOnceEx
Fri 02/05/2021 13:46:23.44: HKLM-RunOnce
Fri 02/05/2021 13:46:34.57: HKLM-Run
Fri 02/05/2021 13:46:35.47: HKCU-Run
Fri 02/05/2021 13:46:35.51: HKCU-RunOnce

I know it's only two tests and it may not be the same on a fresh install, but it does seem to indicate that HKLM-RunOnceEx is executed before HKLM-RunOnce, which would suggest to me that your OOBE registry fix for computers that don't run OOBE.cmd may not work.
 
Last edited:
Your OOBE.cmd adds to RunOnceEx, right?

Are all the HKLM\RunOnce commands executed before the HKLM\RunOnceEx commands are executed?

If not, wouldn't that registry file break the script?

UPDATE:

I've done further testing. After applying the following reg file:


Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKLM-Run\" >>C:\\setup.log"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKLM-RunOnce\" >>C:\\setup.log"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\01]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKLM-RunOnceEx\" >>C:\\setup.log"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKCU-Run\" >>C:\\setup.log"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKCU-RunOnce\" >>C:\\setup.log"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\01]
"1"="C:\\Windows\\System32\\cmd.exe /c \"echo %date% %time%: HKCU-RunOnceEx\" >>C:\\setup.log"

The output to the setup.log was the following after restarting twice:

Code:
Fri 02/05/2021 13:43:45.50: HKLM-RunOnceEx
Fri 02/05/2021 13:43:45.57: HKCU-RunOnceEx
Fri 02/05/2021 13:43:45.66: HKLM-RunOnce
Fri 02/05/2021 13:43:56.77: HKLM-Run
Fri 02/05/2021 13:43:57.75: HKCU-Run
Fri 02/05/2021 13:43:57.80: HKCU-RunOnce

Fri 02/05/2021 13:46:23.28: HKLM-RunOnceEx
Fri 02/05/2021 13:46:23.35: HKCU-RunOnceEx
Fri 02/05/2021 13:46:23.44: HKLM-RunOnce
Fri 02/05/2021 13:46:34.57: HKLM-Run
Fri 02/05/2021 13:46:35.47: HKCU-Run
Fri 02/05/2021 13:46:35.51: HKCU-RunOnce

I know it's only two tests and it may not be the same on a fresh install, but it does seem to indicate that HKLM-RunOnceEx is executed before HKLM-RunOnce, which would suggest to me that your OOBE registry fix for computers that don't run OOBE.cmd may not work.

The RunOnce key is launched during setup like InternetExplorer registering.
Code:
"HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "iessetup"

Let me explain.
1) Boot into WinPE and launch setup, reboot
2) Wait until setup finish all stepst - Here is launched OOBE.cmd from RunOnce key, reboot
3) OOBE is up and RunOnceEx is launched

I'm sure it works great
 
Back
Top