diff --git a/.github/workflows/settings.yml b/.github/workflows/settings.yml
index c45ccc27..b0d39ce7 100644
--- a/.github/workflows/settings.yml
+++ b/.github/workflows/settings.yml
@@ -1,4 +1,4 @@
-name: Validation settings
+name: Settings
on:
workflow_call:
diff --git a/Dockerfile b/Dockerfile
index c5f946f4..f5e0cab3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@
ARG VERSION_ARG="latest"
FROM scratch AS build-amd64
-COPY --from=qemux/qemu:7.42 / /
+COPY --from=qemux/qemu:7.43 / /
ARG TARGETARCH
ARG VERSION_WSDD="1.26"
diff --git a/assets/win10x64-enterprise.cmd b/assets/win10x64-enterprise.cmd
new file mode 100644
index 00000000..100e93f5
--- /dev/null
+++ b/assets/win10x64-enterprise.cmd
@@ -0,0 +1,113 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win10x64-enterprise.xml b/assets/win10x64-enterprise.xml
index c423c726..beadbad0 100644
--- a/assets/win10x64-enterprise.xml
+++ b/assets/win10x64-enterprise.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -249,11 +249,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -328,123 +323,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 12
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win10x64-iot.cmd b/assets/win10x64-iot.cmd
new file mode 100644
index 00000000..100e93f5
--- /dev/null
+++ b/assets/win10x64-iot.cmd
@@ -0,0 +1,113 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win10x64-iot.xml b/assets/win10x64-iot.xml
index ce73fa81..b81e6f60 100644
--- a/assets/win10x64-iot.xml
+++ b/assets/win10x64-iot.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -68,7 +68,7 @@
- 0
+ 1
3
false
@@ -255,11 +255,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -334,123 +329,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 12
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win10x64-ltsc.cmd b/assets/win10x64-ltsc.cmd
new file mode 100644
index 00000000..100e93f5
--- /dev/null
+++ b/assets/win10x64-ltsc.cmd
@@ -0,0 +1,113 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win10x64-ltsc.xml b/assets/win10x64-ltsc.xml
index 7bd48df8..ac4a1b17 100644
--- a/assets/win10x64-ltsc.xml
+++ b/assets/win10x64-ltsc.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -68,7 +68,7 @@
- 0
+ 1
3
false
@@ -252,11 +252,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -331,123 +326,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 12
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win10x64.cmd b/assets/win10x64.cmd
new file mode 100644
index 00000000..100e93f5
--- /dev/null
+++ b/assets/win10x64.cmd
@@ -0,0 +1,113 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win10x64.xml b/assets/win10x64.xml
index 50d6e342..612e698b 100644
--- a/assets/win10x64.xml
+++ b/assets/win10x64.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -249,11 +249,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -328,123 +323,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 12
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win11x64-enterprise.cmd b/assets/win11x64-enterprise.cmd
new file mode 100644
index 00000000..482023ba
--- /dev/null
+++ b/assets/win11x64-enterprise.cmd
@@ -0,0 +1,119 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Disable the SMB signing requirement.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Remove the empty Windows.old folder.
+if exist "%SystemDrive%\Windows.old" rd /q "%SystemDrive%\Windows.old"
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win11x64-enterprise.xml b/assets/win11x64-enterprise.xml
index a0e36a97..801a8d60 100644
--- a/assets/win11x64-enterprise.xml
+++ b/assets/win11x64-enterprise.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -267,16 +267,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait pnputil -i -a "C:\Windows\Drivers\viogpudo\viogpudo.inf"
- Install VirtIO display driver
-
-
- 27
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -351,133 +341,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 2
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
- Disable SMB signing requirement
-
-
- 4
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 5
- powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
- Password Never Expires
-
-
- 6
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 7
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 23
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 24
- cmd /C rd /q C:\Windows.old
- Remove empty Windows.old folder
-
-
- 25
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 26
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 27
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win11x64-iot.cmd b/assets/win11x64-iot.cmd
new file mode 100644
index 00000000..482023ba
--- /dev/null
+++ b/assets/win11x64-iot.cmd
@@ -0,0 +1,119 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Disable the SMB signing requirement.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Remove the empty Windows.old folder.
+if exist "%SystemDrive%\Windows.old" rd /q "%SystemDrive%\Windows.old"
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win11x64-iot.xml b/assets/win11x64-iot.xml
index 9fcd0e6b..6ac3969a 100644
--- a/assets/win11x64-iot.xml
+++ b/assets/win11x64-iot.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -267,16 +267,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait pnputil -i -a "C:\Windows\Drivers\viogpudo\viogpudo.inf"
- Install VirtIO display driver
-
-
- 27
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -351,133 +341,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 2
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
- Disable SMB signing requirement
-
-
- 4
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 5
- powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
- Password Never Expires
-
-
- 6
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 7
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 23
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 24
- cmd /C rd /q C:\Windows.old
- Remove empty Windows.old folder
-
-
- 25
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 26
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 27
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win11x64-ltsc.cmd b/assets/win11x64-ltsc.cmd
new file mode 100644
index 00000000..482023ba
--- /dev/null
+++ b/assets/win11x64-ltsc.cmd
@@ -0,0 +1,119 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Disable the SMB signing requirement.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Remove the empty Windows.old folder.
+if exist "%SystemDrive%\Windows.old" rd /q "%SystemDrive%\Windows.old"
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win11x64-ltsc.xml b/assets/win11x64-ltsc.xml
index 9ba78c1d..07c7abb1 100644
--- a/assets/win11x64-ltsc.xml
+++ b/assets/win11x64-ltsc.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -267,16 +267,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait pnputil -i -a "C:\Windows\Drivers\viogpudo\viogpudo.inf"
- Install VirtIO display driver
-
-
- 27
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -351,133 +341,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 2
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
- Disable SMB signing requirement
-
-
- 4
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 5
- powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
- Password Never Expires
-
-
- 6
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 7
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 23
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 24
- cmd /C rd /q C:\Windows.old
- Remove empty Windows.old folder
-
-
- 25
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 26
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 27
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win11x64.cmd b/assets/win11x64.cmd
new file mode 100644
index 00000000..482023ba
--- /dev/null
+++ b/assets/win11x64.cmd
@@ -0,0 +1,119 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Disable the SMB signing requirement.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Remove the empty Windows.old folder.
+if exist "%SystemDrive%\Windows.old" rd /q "%SystemDrive%\Windows.old"
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Hide Copilot button.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
+
+rem Disable unsupported hardware notifications.
+reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win11x64.xml b/assets/win11x64.xml
index 03f98d28..cb1c741b 100644
--- a/assets/win11x64.xml
+++ b/assets/win11x64.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -267,16 +267,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 26
- cmd.exe /c start "" /b /wait pnputil -i -a "C:\Windows\Drivers\viogpudo\viogpudo.inf"
- Install VirtIO display driver
-
-
- 27
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -351,133 +341,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 2
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
- Disable SMB signing requirement
-
-
- 4
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 5
- powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
- Password Never Expires
-
-
- 6
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 7
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 23
- reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f
- Disable unsupported hardware notifications
-
-
- 24
- cmd /C rd /q C:\Windows.old
- Remove empty Windows.old folder
-
-
- 25
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 26
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 27
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2008r2.cmd b/assets/win2008r2.cmd
new file mode 100644
index 00000000..1b050454
--- /dev/null
+++ b/assets/win2008r2.cmd
@@ -0,0 +1,101 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2008r2.xml b/assets/win2008r2.xml
index 623d998e..d5d500f5 100644
--- a/assets/win2008r2.xml
+++ b/assets/win2008r2.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -157,15 +157,6 @@
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -212,108 +203,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 10
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 11
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 13
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 14
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 15
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 17
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 18
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 19
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 20
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 21
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 22
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2012r2.cmd b/assets/win2012r2.cmd
new file mode 100644
index 00000000..de3c6b32
--- /dev/null
+++ b/assets/win2012r2.cmd
@@ -0,0 +1,98 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2012r2.xml b/assets/win2012r2.xml
index c71a2444..d6e8cf72 100644
--- a/assets/win2012r2.xml
+++ b/assets/win2012r2.xml
@@ -14,7 +14,7 @@
- 0
+ 1
true
@@ -69,7 +69,7 @@
- 0
+ 1
3
OnError
@@ -158,11 +158,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -241,98 +236,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 17
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 18
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 19
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 20
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2016.cmd b/assets/win2016.cmd
new file mode 100644
index 00000000..7cf9f067
--- /dev/null
+++ b/assets/win2016.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2016.xml b/assets/win2016.xml
index 7310e8fe..59fb097a 100644
--- a/assets/win2016.xml
+++ b/assets/win2016.xml
@@ -14,7 +14,7 @@
- 0
+ 1
true
@@ -69,7 +69,7 @@
- 0
+ 1
3
OnError
@@ -158,11 +158,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -241,118 +236,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 18
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 19
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 20
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 23
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 24
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2019-hv.cmd b/assets/win2019-hv.cmd
new file mode 100644
index 00000000..7cf9f067
--- /dev/null
+++ b/assets/win2019-hv.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2019-hv.xml b/assets/win2019-hv.xml
index 45b8bb54..988b3786 100644
--- a/assets/win2019-hv.xml
+++ b/assets/win2019-hv.xml
@@ -14,7 +14,7 @@
- 0
+ 1
true
@@ -69,7 +69,7 @@
- 0
+ 1
3
OnError
@@ -164,11 +164,6 @@
dism.exe /online /Disable-Feature /FeatureName:Microsoft-Hyper-V /NoRestart
Disable Hyper-V role
-
- 3
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -247,118 +242,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 18
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 19
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 20
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 23
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 24
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2019.cmd b/assets/win2019.cmd
new file mode 100644
index 00000000..7cf9f067
--- /dev/null
+++ b/assets/win2019.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2019.xml b/assets/win2019.xml
index b9f39de4..720776c5 100644
--- a/assets/win2019.xml
+++ b/assets/win2019.xml
@@ -14,7 +14,7 @@
- 0
+ 1
true
@@ -69,7 +69,7 @@
- 0
+ 1
3
OnError
@@ -162,11 +162,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -245,118 +240,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 18
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 19
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 20
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 23
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 24
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2022.cmd b/assets/win2022.cmd
new file mode 100644
index 00000000..7cf9f067
--- /dev/null
+++ b/assets/win2022.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Remove Search from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
+
+rem Remove Task View from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+
+rem Remove Widgets from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+
+rem Remove Chat from the Taskbar.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2022.xml b/assets/win2022.xml
index b7c2f056..dadf5f40 100644
--- a/assets/win2022.xml
+++ b/assets/win2022.xml
@@ -14,7 +14,7 @@
- 0
+ 1
true
@@ -69,7 +69,7 @@
- 0
+ 1
3
OnError
@@ -162,11 +162,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -245,118 +240,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
- Remove Search from the Taskbar
-
-
- 15
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 18
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 19
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 20
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 23
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 24
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win2025.cmd b/assets/win2025.cmd
new file mode 100644
index 00000000..c7061708
--- /dev/null
+++ b/assets/win2025.cmd
@@ -0,0 +1,97 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Disable the SMB signing requirement.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation and monitor blanking.
+POWERCFG -H OFF
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable the first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Allow RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery and File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Remove the empty Windows.old folder.
+if exist "%SystemDrive%\Windows.old" rd /q "%SystemDrive%\Windows.old"
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Set initial Explorer and taskbar preferences for the logged-in user.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win2025.xml b/assets/win2025.xml
index 242f6d71..9abfe05c 100644
--- a/assets/win2025.xml
+++ b/assets/win2025.xml
@@ -14,7 +14,7 @@
- 0
+ 1
true
@@ -69,7 +69,7 @@
- 0
+ 1
3
OnError
@@ -162,16 +162,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait pnputil -i -a "C:\Windows\Drivers\viogpudo\viogpudo.inf"
- Install VirtIO display driver
-
-
- 4
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -250,123 +240,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 2
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
- Disable SMB signing requirement
-
-
- 4
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 5
- powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
- Password Never Expires
-
-
- 6
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 7
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 9
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
- Hide Copilot button
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 16
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
- Remove Task View from the Taskbar
-
-
- 17
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
- Remove Widgets from the Taskbar
-
-
- 18
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
- Remove Chat from the Taskbar
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 20
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 22
- cmd /C rd /q C:\Windows.old
- Remove empty Windows.old folder
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win7x64-enterprise.cmd b/assets/win7x64-enterprise.cmd
new file mode 100644
index 00000000..74bd7491
--- /dev/null
+++ b/assets/win7x64-enterprise.cmd
@@ -0,0 +1,92 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win7x64-enterprise.xml b/assets/win7x64-enterprise.xml
index 1f6a46ab..8bbbe1ef 100644
--- a/assets/win7x64-enterprise.xml
+++ b/assets/win7x64-enterprise.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -152,15 +152,6 @@
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -207,93 +198,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 17
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 18
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 19
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win7x64-ultimate.cmd b/assets/win7x64-ultimate.cmd
new file mode 100644
index 00000000..74bd7491
--- /dev/null
+++ b/assets/win7x64-ultimate.cmd
@@ -0,0 +1,92 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win7x64-ultimate.xml b/assets/win7x64-ultimate.xml
index 1e2db60c..ac6ca449 100644
--- a/assets/win7x64-ultimate.xml
+++ b/assets/win7x64-ultimate.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -152,15 +152,6 @@
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -207,93 +198,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 17
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 18
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 19
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win7x64.cmd b/assets/win7x64.cmd
new file mode 100644
index 00000000..74bd7491
--- /dev/null
+++ b/assets/win7x64.cmd
@@ -0,0 +1,92 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win7x64.xml b/assets/win7x64.xml
index 1cb88e4a..889a9d96 100644
--- a/assets/win7x64.xml
+++ b/assets/win7x64.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -152,15 +152,6 @@
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -207,93 +198,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 17
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 18
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 19
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win7x86-enterprise.cmd b/assets/win7x86-enterprise.cmd
new file mode 100644
index 00000000..81832c42
--- /dev/null
+++ b/assets/win7x86-enterprise.cmd
@@ -0,0 +1,88 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win7x86-enterprise.xml b/assets/win7x86-enterprise.xml
index 02ff34d6..59308778 100644
--- a/assets/win7x86-enterprise.xml
+++ b/assets/win7x86-enterprise.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -198,93 +198,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 17
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 18
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 19
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win7x86-ultimate.cmd b/assets/win7x86-ultimate.cmd
new file mode 100644
index 00000000..81832c42
--- /dev/null
+++ b/assets/win7x86-ultimate.cmd
@@ -0,0 +1,88 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win7x86-ultimate.xml b/assets/win7x86-ultimate.xml
index b40033cc..8049200d 100644
--- a/assets/win7x86-ultimate.xml
+++ b/assets/win7x86-ultimate.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -198,93 +198,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 17
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 18
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 19
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win7x86.cmd b/assets/win7x86.cmd
new file mode 100644
index 00000000..81832c42
--- /dev/null
+++ b/assets/win7x86.cmd
@@ -0,0 +1,88 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteAPP to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win7x86.xml b/assets/win7x86.xml
index 1b8cb27e..d66fe6a8 100644
--- a/assets/win7x86.xml
+++ b/assets/win7x86.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -57,7 +57,7 @@
- 0
+ 1
2
false
@@ -198,93 +198,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteAPP to launch unlisted programs
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 17
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 18
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 19
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win81x64-enterprise.cmd b/assets/win81x64-enterprise.cmd
new file mode 100644
index 00000000..de3c6b32
--- /dev/null
+++ b/assets/win81x64-enterprise.cmd
@@ -0,0 +1,98 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win81x64-enterprise.xml b/assets/win81x64-enterprise.xml
index 4e9fde86..a22f7cf3 100644
--- a/assets/win81x64-enterprise.xml
+++ b/assets/win81x64-enterprise.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -62,7 +62,7 @@
- 0
+ 1
3
false
@@ -149,11 +149,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -226,98 +221,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 17
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 18
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 19
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 20
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/win81x64.cmd b/assets/win81x64.cmd
new file mode 100644
index 00000000..de3c6b32
--- /dev/null
+++ b/assets/win81x64.cmd
@@ -0,0 +1,98 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem Enable the option for passwordless sign-in.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Turn off automatic Windows Update downloads.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
+pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/win81x64.xml b/assets/win81x64.xml
index bc1fed3b..e0a12672 100644
--- a/assets/win81x64.xml
+++ b/assets/win81x64.xml
@@ -13,7 +13,7 @@
- 0
+ 1
true
@@ -68,7 +68,7 @@
- 0
+ 1
3
false
@@ -156,11 +156,6 @@
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 1 /f
Set Network Location to Home
-
- 2
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
@@ -233,98 +228,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
- Enable option for passwordless sign-in
-
-
- 4
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 5
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 6
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 7
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 8
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 9
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 10
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 11
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 12
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 13
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 14
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
- Turn off Windows Update auto download
-
-
- 15
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 16
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 17
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 18
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 19
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 20
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/winvistax64-enterprise.cmd b/assets/winvistax64-enterprise.cmd
new file mode 100644
index 00000000..0f8d96d7
--- /dev/null
+++ b/assets/winvistax64-enterprise.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Add RDP in firewall.
+netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
+
+rem Enable RDP.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
+
+rem Turn off sidebar.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/winvistax64-enterprise.xml b/assets/winvistax64-enterprise.xml
index 7bb1f457..3e9c4bff 100644
--- a/assets/winvistax64-enterprise.xml
+++ b/assets/winvistax64-enterprise.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -44,7 +44,7 @@
- 0
+ 1
1
OnError
@@ -90,15 +90,6 @@
false
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -156,123 +147,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
- Add RDP in firewall
-
-
- 15
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Enable RDP
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
- Turn off sidebar
-
-
- 17
- reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
- Disable screensaver
-
-
- 18
- reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
- Disable screensaver
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 20
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/winvistax64-ultimate.cmd b/assets/winvistax64-ultimate.cmd
new file mode 100644
index 00000000..0f8d96d7
--- /dev/null
+++ b/assets/winvistax64-ultimate.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Add RDP in firewall.
+netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
+
+rem Enable RDP.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
+
+rem Turn off sidebar.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/winvistax64-ultimate.xml b/assets/winvistax64-ultimate.xml
index 6cf665e5..10bf62fa 100644
--- a/assets/winvistax64-ultimate.xml
+++ b/assets/winvistax64-ultimate.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -44,7 +44,7 @@
- 0
+ 1
1
OnError
@@ -90,15 +90,6 @@
false
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -156,123 +147,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
- Add RDP in firewall
-
-
- 15
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Enable RDP
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
- Turn off sidebar
-
-
- 17
- reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
- Disable screensaver
-
-
- 18
- reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
- Disable screensaver
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 20
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/winvistax64.cmd b/assets/winvistax64.cmd
new file mode 100644
index 00000000..0f8d96d7
--- /dev/null
+++ b/assets/winvistax64.cmd
@@ -0,0 +1,110 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Add RDP in firewall.
+netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
+
+rem Enable RDP.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
+
+rem Turn off sidebar.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem Install the VirtIO Balloon service once.
+sc.exe query BalloonService >nul 2>&1
+if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/winvistax64.xml b/assets/winvistax64.xml
index bf360ba4..c120618c 100644
--- a/assets/winvistax64.xml
+++ b/assets/winvistax64.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -44,7 +44,7 @@
- 0
+ 1
1
OnError
@@ -90,15 +90,6 @@
false
-
-
-
- 1
- cmd.exe /c start "" /b /wait "C:\Windows\Drivers\Balloon\blnsvr.exe" -i
- Install VirtIO Balloon service
-
-
-
@@ -156,123 +147,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
- Add RDP in firewall
-
-
- 15
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Enable RDP
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
- Turn off sidebar
-
-
- 17
- reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
- Disable screensaver
-
-
- 18
- reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
- Disable screensaver
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 20
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/winvistax86-enterprise.cmd b/assets/winvistax86-enterprise.cmd
new file mode 100644
index 00000000..aa023193
--- /dev/null
+++ b/assets/winvistax86-enterprise.cmd
@@ -0,0 +1,106 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Add RDP in firewall.
+netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
+
+rem Enable RDP.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
+
+rem Turn off sidebar.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/winvistax86-enterprise.xml b/assets/winvistax86-enterprise.xml
index 3d280066..f9fb949a 100644
--- a/assets/winvistax86-enterprise.xml
+++ b/assets/winvistax86-enterprise.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -44,7 +44,7 @@
- 0
+ 1
1
OnError
@@ -147,123 +147,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
- Add RDP in firewall
-
-
- 15
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Enable RDP
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
- Turn off sidebar
-
-
- 17
- reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
- Disable screensaver
-
-
- 18
- reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
- Disable screensaver
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 20
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/winvistax86-ultimate.cmd b/assets/winvistax86-ultimate.cmd
new file mode 100644
index 00000000..aa023193
--- /dev/null
+++ b/assets/winvistax86-ultimate.cmd
@@ -0,0 +1,106 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Add RDP in firewall.
+netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
+
+rem Enable RDP.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
+
+rem Turn off sidebar.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/winvistax86-ultimate.xml b/assets/winvistax86-ultimate.xml
index 1acf4dfe..4e6eff9e 100644
--- a/assets/winvistax86-ultimate.xml
+++ b/assets/winvistax86-ultimate.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -44,7 +44,7 @@
- 0
+ 1
1
OnError
@@ -147,123 +147,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
- Add RDP in firewall
-
-
- 15
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Enable RDP
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
- Turn off sidebar
-
-
- 17
- reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
- Disable screensaver
-
-
- 18
- reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
- Disable screensaver
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 20
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/assets/winvistax86.cmd b/assets/winvistax86.cmd
new file mode 100644
index 00000000..aa023193
--- /dev/null
+++ b/assets/winvistax86.cmd
@@ -0,0 +1,106 @@
+@echo off
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
+set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
+
+if "%~1"=="" goto setup
+if /i "%~1"=="setup" goto setup
+if /i "%~1"=="logon" goto logon
+exit /b 2
+
+:setup
+if exist "%SETUP_COMPLETE%" exit /b 0
+
+type nul > "%SETUP_STARTED%"
+
+rem Allow guest access to network shares.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
+
+rem BEGIN LOCAL_ACCOUNT
+rem Prevent the local user password from expiring.
+wmic useraccount where name="Docker" set PasswordExpires=false
+rem END LOCAL_ACCOUNT
+
+rem Disable hibernation.
+POWERCFG -H OFF
+
+rem Disable monitor blanking.
+POWERCFG -X -monitor-timeout-ac 0
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
+
+rem Disable Network Discovery popup.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
+
+rem Disable first-run experience in Edge.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
+
+rem Disable hibernation in the registry.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
+
+rem Disable hibernation.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
+
+rem Disable sleep.
+POWERCFG -X -standby-timeout-ac 0
+
+rem Add RDP in firewall.
+netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
+
+rem Enable RDP.
+reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
+
+rem Turn off sidebar.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
+
+rem Enable RemoteApp to launch unlisted programs.
+reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
+
+rem Disable RemoteApp allowlist.
+reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
+
+rem Enable Network Discovery.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
+
+rem Enable File Sharing.
+netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
+
+rem BEGIN PRODUCT_KEY
+rem Install the product key without activating Windows immediately.
+cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
+rem END PRODUCT_KEY
+
+type nul > "%SETUP_COMPLETE%"
+exit /b 0
+
+:logon
+rem Run the machine setup here when SetupComplete.cmd was skipped.
+if not exist "%SETUP_COMPLETE%" call "%~f0" setup
+
+rem Show file extensions in Explorer.
+reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
+
+rem Disable screensaver.
+reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
+
+rem BEGIN SHARED_FOLDER
+rem Add the shared folder to the desktop and map it to drive Z:.
+if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
+net.exe use Z: \\host.lan\Data /persistent:yes
+rem END SHARED_FOLDER
+
+rem BEGIN OEM_SCRIPT
+rem Launch the custom script asynchronously in a separate visible window.
+if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
+rem END OEM_SCRIPT
+
+exit /b 0
diff --git a/assets/winvistax86.xml b/assets/winvistax86.xml
index 9c799afa..efdae8c6 100644
--- a/assets/winvistax86.xml
+++ b/assets/winvistax86.xml
@@ -14,7 +14,7 @@
OnError
- 0
+ 1
true
@@ -44,7 +44,7 @@
- 0
+ 1
1
OnError
@@ -147,123 +147,8 @@
1
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
- Allow guest access to network shares
-
-
- 3
- cmd /C wmic useraccount where name="Docker" set PasswordExpires=false
- Password Never Expires
-
-
- 4
- cmd /C POWERCFG -H OFF
- Disable Hibernation
-
-
- 5
- cmd /C POWERCFG -X -monitor-timeout-ac 0
- Disable monitor blanking
-
-
- 6
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
- Disable Network Discovery popup
-
-
- 7
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NetworkLocationWizard" /v "HideWizard" /t REG_DWORD /d 1 /f
- Disable Network Discovery popup
-
-
- 8
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" /v NetworkList /t REG_MULTI_SZ /d "" /f
- Disable Network Discovery popup
-
-
- 9
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
- Disable first-run experience in Edge
-
-
- 10
- reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
- Show file extensions in Explorer
-
-
- 11
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
- Zero Hibernation File
-
-
- 12
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
- Disable Hibernation
-
-
- 13
- cmd /C POWERCFG -X -standby-timeout-ac 0
- Disable Sleep
-
-
- 14
- netsh.exe advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=Yes
- Add RDP in firewall
-
-
- 15
- reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Enable RDP
-
-
- 16
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar" /v "TurnOffSidebar" /t REG_DWORD /d 1 /f
- Turn off sidebar
-
-
- 17
- reg.exe add "HKCU\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f
- Disable screensaver
-
-
- 18
- reg.exe add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\scrnsavex.scr /f
- Disable screensaver
-
-
- 19
- reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
- Enable RemoteApp to launch unlisted programs
-
-
- 20
- reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
- Disable RemoteApp allowlist
-
-
- 21
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
- Enable Network Discovery
-
-
- 22
- netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
- Enable File Sharing
-
-
- 23
- cmd /C mklink /d %userprofile%\Desktop\Shared \\host.lan\Data
- Create desktop shortcut to shared folder
-
-
- 24
- cmd /C net use Z: \\host.lan\Data /persistent:yes
- Map shared folder
-
-
- 25
- cmd /C if exist "C:\OEM\install.bat" start "Install" "cmd /C C:\OEM\install.bat"
- Execute custom script from the OEM folder if exists
+ cmd.exe /d /c call "%WINDIR%\Setup\Scripts\SetupComplete.cmd" logon
+ Configure Windows after logon
diff --git a/src/answer.sh b/src/answer.sh
index b00614b4..da75ba68 100644
--- a/src/answer.sh
+++ b/src/answer.sh
@@ -30,7 +30,7 @@ stageAnswer() {
local language="$2"
local stage="$3"
local answer="$stage/Autounattend.xml"
- local name
+ local script="" name
if enabled "$MANUAL"; then
removeGeneratedXML "$asset" || return 1
@@ -59,9 +59,9 @@ stageAnswer() {
fi
fi
- if ! updateDiskID "$answer" "${DISK_TYPE:-}"; then
+ if ! updateDiskID "$answer" "${DISK_TYPE:-}" "setup"; then
error "Failed to adjust the Windows installation disk!"
- return 1
+ exit 85
fi
if ! setConfigurationXML "$answer"; then
@@ -71,6 +71,10 @@ stageAnswer() {
validateGeneratedXML "$answer" || return 1
+ if [ -z "${CUSTOM_XML:-}" ]; then
+ prepareSetupScript "$asset" "$stage" script || exit 84
+ fi
+
return 0
}
@@ -332,14 +336,14 @@ updateXML() {
if [ -n "$domain" ]; then
prepareDomainAccount "$domain" account auth || return 1
else
- updateLocalAccountXML "$asset" || return 1
+ updateLocalAccount "$asset" || return 1
fi
sed -i -E \
"s|[^<]*|false|g" \
"$asset" || return 1
- updateMembershipXML \
+ updateMembership \
"$asset" \
"$domain" \
"$workgroup" \
@@ -347,15 +351,301 @@ updateXML() {
"$auth" || return 1
updateAutologinXML "$asset" || return 1
- enableLog "$asset" || return 1
updateEditionXML "$asset" || return 1
- updateProductKeyXML "$asset" || return 1
- removeSharedFolderXML "$asset" || return 1
validateGeneratedXML "$asset" || return 1
return 0
}
+prepareSetupScript() {
+
+ local asset="$1"
+ local stage="$2"
+ local result_name="$3"
+ local staged=""
+
+ printf -v "$result_name" '%s' ""
+
+ stageSetupScript "$asset" "$stage" staged || return 1
+ [ -n "$staged" ] || return 0
+
+ updateSetupScript "$staged" "$asset" || return 1
+ finalizeSetupScript "$staged" || return 1
+
+ printf -v "$result_name" '%s' "$staged"
+ return 0
+}
+
+updateSetupScript() {
+
+ local script="$1"
+ local asset="$2"
+ local domain="${DOMAIN:-}"
+ local user="${USERNAME:-}"
+ local content id
+
+ if [ ! -s "$script" ]; then
+ error "Failed to find staged setup script: $script"
+ return 1
+ fi
+
+ if [ -n "$domain" ]; then
+ removeSetupBlock "$script" "LOCAL_ACCOUNT" || return 1
+ elif [ -n "$user" ]; then
+ validateUsername "$user" "local" || return 1
+
+ id=$(basename "$asset") || return 1
+ id="${id%.*}"
+
+ case "${id,,}" in
+ "win10"* | "win11"* | \
+ "win2016"* | "win2019"* | "win2022"* | "win2025"* )
+ printf -v content '%s\n%s' \
+ 'rem Prevent the local user password from expiring.' \
+ "powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive Set-LocalUser -Name \"$user\" -PasswordNeverExpires 1"
+ ;;
+ * )
+ printf -v content '%s\n%s' \
+ 'rem Prevent the local user password from expiring.' \
+ "wmic useraccount where name=\"$user\" set PasswordExpires=false"
+ ;;
+ esac
+
+ replaceSetupBlock "$script" "LOCAL_ACCOUNT" "$content" || return 1
+ fi
+
+ enableLog "$script" || return 1
+ updateProductKey "$script" || return 1
+ removeSharedFolder "$script" || return 1
+
+ return 0
+}
+
+findSetupScript() {
+
+ local asset="$1"
+ local dir name id normal candidate
+ local candidates=()
+
+ [ -z "${CUSTOM_XML:-}" ] || return 0
+ [ -n "$asset" ] || return 1
+
+ dir=$(dirname "$asset") || return 1
+ name=$(basename "$asset") || return 1
+ id="${name%.*}"
+ normal="$id"
+
+ candidates+=("$dir/$id.cmd")
+
+ if [[ "${normal,,}" == *"-eval" ]]; then
+ normal="${normal::-5}"
+ candidates+=("$dir/$normal.cmd")
+ fi
+
+ # Generated edition-specific answer files inherit the script belonging to
+ # their generic source template.
+ case "${normal,,}" in
+ "win7"* | "win8"* | "win10"* | "win11"* | "winvista"* | "win20"* )
+ candidates+=("$dir/${normal%%-*}.cmd")
+ ;;
+ esac
+
+ for candidate in "${candidates[@]}"; do
+ if [ -f "$candidate" ] && [ -s "$candidate" ]; then
+ printf '%s' "$candidate"
+ return 0
+ fi
+ done
+
+ error "Failed to find setup script for answer file: $asset"
+ return 1
+}
+
+stageSetupScript() {
+
+ local asset="$1"
+ local stage="$2"
+ local result_name="$3"
+ local source target
+
+ printf -v "$result_name" '%s' ""
+
+ source=$(findSetupScript "$asset") || return 1
+ [ -n "$source" ] || return 0
+
+ target="$stage/\$OEM\$/\$\$/Setup/Scripts/SetupComplete.cmd"
+
+ if ! mkdir -p "$(dirname "$target")"; then
+ error "Failed to create setup script directory!"
+ return 1
+ fi
+
+ if ! cp -L -- "$source" "$target"; then
+ error "Failed to stage setup script: $source"
+ return 1
+ fi
+
+ # Work on a normalized copy so marker updates are independent of the line
+ # endings stored in Git. The staged result is converted back to CRLF later.
+ if ! sed -i 's/\r$//' "$target"; then
+ error "Failed to normalize setup script: $target"
+ return 1
+ fi
+
+ validateSetupScript "$target" || return 1
+
+ printf -v "$result_name" '%s' "$target"
+ return 0
+}
+
+installSetupScript() {
+
+ local script="$1"
+ local root="$2"
+ local target
+
+ [ -n "$script" ] || return 0
+
+ if [ ! -s "$script" ]; then
+ error "Failed to find staged setup script: $script"
+ return 1
+ fi
+
+ target="$root/\$OEM\$/\$\$/Setup/Scripts/SetupComplete.cmd"
+
+ if ! mkdir -p "$(dirname "$target")"; then
+ error "Failed to create setup script directory!"
+ return 1
+ fi
+
+ if ! cp -f -- "$script" "$target"; then
+ error "Failed to add setup script to Windows image!"
+ return 1
+ fi
+
+ return 0
+}
+
+replaceSetupBlock() {
+
+ local file="$1"
+ local block="$2"
+ local content="$3"
+ local begin="rem BEGIN $block"
+ local end="rem END $block"
+ local line inside=0 tmp
+
+ validateSetupBlock "$file" "$block" || return 1
+
+ if ! tmp=$(mktemp "${file}.XXXXXX"); then
+ error "Failed to create temporary setup script!"
+ return 1
+ fi
+
+ while IFS= read -r line || [ -n "$line" ]; do
+
+ if [ "$line" = "$begin" ]; then
+ if ! printf '%s\n' "$line" >> "$tmp" ||
+ ! printf '%s\n' "$content" >> "$tmp"; then
+ rm -f "$tmp"
+ return 1
+ fi
+ inside=1
+ continue
+ fi
+
+ if [ "$line" = "$end" ]; then
+ inside=0
+ if ! printf '%s\n' "$line" >> "$tmp"; then
+ rm -f "$tmp"
+ return 1
+ fi
+ continue
+ fi
+
+ if (( ! inside )); then
+ if ! printf '%s\n' "$line" >> "$tmp"; then
+ rm -f "$tmp"
+ return 1
+ fi
+ fi
+
+ done < "$file"
+
+ if ! chmod --reference="$file" "$tmp" ||
+ ! mv -f -- "$tmp" "$file"; then
+ rm -f "$tmp"
+ error "Failed to replace the $block block in setup script: $file"
+ return 1
+ fi
+
+ return 0
+}
+
+removeSetupBlock() {
+
+ local file="$1"
+ local block="$2"
+ local begin="rem BEGIN $block"
+ local end="rem END $block"
+ local line inside=0 tmp
+
+ validateSetupBlock "$file" "$block" || return 1
+
+ if ! tmp=$(mktemp "${file}.XXXXXX"); then
+ error "Failed to create temporary setup script!"
+ return 1
+ fi
+
+ while IFS= read -r line || [ -n "$line" ]; do
+
+ if [ "$line" = "$begin" ]; then
+ inside=1
+ continue
+ fi
+
+ if [ "$line" = "$end" ]; then
+ inside=0
+ continue
+ fi
+
+ if (( ! inside )); then
+ if ! printf '%s\n' "$line" >> "$tmp"; then
+ rm -f "$tmp"
+ return 1
+ fi
+ fi
+
+ done < "$file"
+
+ if ! chmod --reference="$file" "$tmp" ||
+ ! mv -f -- "$tmp" "$file"; then
+ rm -f "$tmp"
+ error "Failed to remove the $block block from setup script: $file"
+ return 1
+ fi
+
+ return 0
+}
+
+finalizeSetupScript() {
+
+ local file="$1"
+
+ [ -n "$file" ] || return 0
+ if [ ! -s "$file" ]; then
+ error "Failed to find staged setup script: $file"
+ return 1
+ fi
+
+ if ! unix2dos -q "$file"; then
+ error "Failed to convert setup script to DOS format: $file"
+ return 1
+ fi
+
+ return 0
+}
+
validateGeneratedXML() {
local asset="$1"
@@ -368,6 +658,55 @@ validateGeneratedXML() {
return 0
}
+validateSetupScript() {
+
+ local file="$1"
+ local block
+ local blocks=(
+ LOCAL_ACCOUNT
+ PRODUCT_KEY
+ SHARED_FOLDER
+ OEM_SCRIPT
+ )
+
+ [ -s "$file" ] || return 1
+
+ for block in "${blocks[@]}"; do
+ validateSetupBlock "$file" "$block" || return 1
+ done
+
+ return 0
+}
+
+validateSetupBlock() {
+
+ local file="$1"
+ local block="$2"
+ local begin="rem BEGIN $block"
+ local end="rem END $block"
+ local begin_count end_count begin_line end_line
+
+ [ -s "$file" ] || return 1
+
+ begin_count=$(grep -Fxc -- "$begin" "$file" || true)
+ end_count=$(grep -Fxc -- "$end" "$file" || true)
+
+ if [ "$begin_count" -ne 1 ] || [ "$end_count" -ne 1 ]; then
+ error "Invalid $block markers in setup script: $file"
+ return 1
+ fi
+
+ begin_line=$(grep -nFx -- "$begin" "$file" | cut -d: -f1) || return 1
+ end_line=$(grep -nFx -- "$end" "$file" | cut -d: -f1) || return 1
+
+ if [ "$begin_line" -ge "$end_line" ]; then
+ error "Invalid $block marker order in setup script: $file"
+ return 1
+ fi
+
+ return 0
+}
+
validateXMLSettings() {
validateResolution "WIDTH" "$WIDTH" 320 || return 1
@@ -881,7 +1220,7 @@ updateLocaleXML() {
return 0
}
-updateLocalAccountXML() {
+updateLocalAccount() {
local asset="$1"
local user="${USERNAME:-}"
@@ -892,9 +1231,6 @@ updateLocalAccountXML() {
if [ -n "$user" ]; then
user_xml=$(escapeXMLSed "$user") || return 1
-
- sed -i "s|-name \"Docker\"|-name \"\$env:USERNAME\"|g" "$asset" || return 1
- sed -i 's|where name="Docker"|where name="%USERNAME%"|g' "$asset" || return 1
sed -i "s|Docker|$user_xml|g" "$asset" || return 1
sed -i "s|Docker|$user_xml|g" "$asset" || return 1
sed -i "s|Docker|$user_xml|g" "$asset" || return 1
@@ -919,7 +1255,7 @@ updateLocalAccountXML() {
return 0
}
-updateMembershipXML() {
+updateMembership() {
local asset="$1"
local domain="$2"
@@ -941,7 +1277,7 @@ updateMembershipXML() {
return 0
fi
- removeLocalAccountXML "$asset" || return 1
+ removeLocalAccount "$asset" || return 1
return 0
fi
@@ -986,28 +1322,22 @@ updateEditionXML() {
return 0
}
-updateProductKeyXML() {
+updateProductKey() {
- local asset="$1"
- local key
+ local script="$1"
+ local key="${KEY:-}"
+ local content
- return 0 # TODO
+ if [ -z "$key" ]; then
+ removeSetupBlock "$script" "PRODUCT_KEY" || return 1
+ return 0
+ fi
- [ -n "${KEY:-}" ] || return 0
+ printf -v content '%s\n%s' \
+ 'rem Install the product key without activating Windows immediately.' \
+ "cscript.exe //B //Nologo \"%SystemRoot%\\System32\\slmgr.vbs\" /ipk \"$key\""
- key=$(escapeXMLSed "$KEY") || return 1
-
- sed -i -E \
- '/^[[:space:]]*[[:space:]]*$/,/^[[:space:]]*<\/ProductKey>[[:space:]]*$/d' \
- "$asset" || return 1
-
- sed -i -E \
- "s|[^<]*|$key|g" \
- "$asset" || return 1
-
- sed -i \
- "s|| \n $key\n OnError\n \n |g" \
- "$asset" || return 1
+ replaceSetupBlock "$script" "PRODUCT_KEY" "$content" || return 1
return 0
}
@@ -1016,23 +1346,56 @@ updateDiskID() {
local asset="$1"
local disk_type="${2,,}"
-
- case "$disk_type" in
- "" | "scsi" | "virtio-scsi" | "blk" | "virtio-blk" ) ;;
- * ) return 0 ;;
- esac
+ local mode="${3:-setup}"
+ local target="0"
+ local matches ids current count rc
[ -s "$asset" ] || return 1
- # Only adjust files that explicitly target Disk 0.
- grep -Fq '0' "$asset" || return 0
+ case "$mode" in
+ "setup" )
+ case "$disk_type" in
+ "" | "scsi" | "virtio-scsi" | "blk" | "virtio-blk" ) target="1" ;;
+ esac
+ ;;
+ "image" ) ;;
+ * ) return 1 ;;
+ esac
- # Leave multi-disk configurations untouched.
- if grep -Eq '[[:space:]]*[1-9][0-9]*[[:space:]]*' "$asset"; then
- return 0
+ matches=$(grep -oE '[[:space:]]*[0-9]+[[:space:]]*' "$asset") || {
+ rc=$?
+ if [ "$rc" -eq 1 ]; then
+ matches=""
+ else
+ error "Failed to read DiskID values from answer file: $asset"
+ return 1
+ fi
+ }
+
+ # Some custom answer files do not contain a disk configuration.
+ [ -n "$matches" ] || return 0
+
+ ids=$(printf '%s\n' "$matches" |
+ sed -E 's#.*[[:space:]]*([0-9]+)[[:space:]]*.*#\1#' |
+ sort -u) || return 1
+
+ count=$(printf '%s\n' "$ids" | wc -l) || return 1
+
+ # Leave explicit multi-disk configurations untouched.
+ [ "$count" -eq 1 ] || return 0
+
+ current="$ids"
+ [ "$current" = "$target" ] && return 0
+
+ if [ "$current" != "1" ]; then
+ error "The answer file must use DiskID 1 as its template value: $asset"
+ return 1
fi
- sed -i 's#0#1#g' "$asset" || return 1
+ if ! sed -i 's#1#0#g' "$asset"; then
+ error "Failed to update DiskID in answer file: $asset"
+ return 1
+ fi
return 0
}
@@ -1095,33 +1458,21 @@ setConfigurationXML() {
return 0
}
-removeSharedFolderXML() {
+removeSharedFolder() {
- local asset="$1"
+ local script="$1"
if ! disabled "${SHORTCUT:-}" &&
! disabled "${SAMBA:-}"; then
return 0
fi
- if ! sed -i -E '
- /])/ {
- :command
- N
- /<\/SynchronousCommand>/!b command
- /Create desktop shortcut to shared folder<\/Description>/d
- /Map shared folder<\/Description>/d
- }
- ' "$asset"; then
-
- error "Failed to remove shared folder shortcuts from answer file!"
- return 1
- fi
+ removeSetupBlock "$script" "SHARED_FOLDER" || return 1
return 0
}
-removeLocalAccountXML() {
+removeLocalAccount() {
local asset="$1"
@@ -1134,42 +1485,21 @@ removeLocalAccountXML() {
return 1
fi
- if ! sed -i -E '
- /])/ {
- :command
- N
- /<\/SynchronousCommand>/!b command
- /Password Never Expires<\/Description>/d
- }
- ' "$asset"; then
-
- error "Failed to remove local account commands from answer file!"
- return 1
- fi
-
return 0
}
enableLog() {
- local file="$1"
- local old='C:\OEM\install.bat"'
- local msg="failed to enable install logging in the answer file!"
+ local script="$1"
+ local content
enabled "${LOG:-}" || return 0
- [ -f "$file" ] || return 1
- if ! grep -Fq "$old" "$file"; then
- enabled "$DEBUG" && warn "$msg"
- return 0
- fi
+ printf -v content '%s\n%s' \
+ 'rem Launch the custom script asynchronously in a separate visible window.' \
+ 'if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat" > "C:\OEM\install.log" 2>&1"'
- if ! sed -i \
- 's|C:\\OEM\\install\.bat"|C:\\OEM\\install.bat \> C:\\OEM\\install.log 2\>\&1"|' \
- "$file"; then
-
- warn "$msg"
- fi
+ replaceSetupBlock "$script" "OEM_SCRIPT" "$content" || return 1
return 0
}
diff --git a/src/install.sh b/src/install.sh
index 4ffcb19f..23cef87e 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -Eeuo pipefail
-installWindows() {
+startWindows() {
parseVersion || return 58
parseLanguage || return 62
@@ -81,8 +81,7 @@ installWindows() {
fi
if ! createSetupImage "$TMP/setup" "$STORAGE/setup.img"; then
- abortInstall "$dir" "$ISO" "$boot" || return 86
- return 0
+ exit 86
fi
useOriginalImage "$ISO" || return 88
@@ -120,6 +119,7 @@ bootWindows() {
restoreMachineState || return 1
restoreBootMode || return 1
restoreMachine || return 1
+ reserveSambaPorts || return 1
return 0
}
@@ -406,6 +406,8 @@ finishInstall() {
fi
fi
+ reserveSambaPorts || return 1
+
rm -rf "$TMP"
return 0
}
@@ -439,7 +441,10 @@ findFile() {
local size
size="$(stat -c%s "$file")"
- [ -z "$size" ] || [[ "$size" == "0" ]] && return 0
+
+ if [ -z "$size" ] || [[ "$size" == "0" ]]; then
+ return 0
+ fi
ISO="$file"
CUSTOM="$file"
@@ -779,25 +784,36 @@ setMachine() {
local iso="$2"
local dir="$3"
local desc="$4"
- local legacy=""
ETFS="boot/etfsboot.com"
+ local version=""
case "${id,,}" in
- "win2k"* ) legacy="2k" ;;
- "winxp"* ) legacy="xp" ;;
- "win2003"* ) legacy="2k3" ;;
+ "win2k"* ) version="2k" ;;
+ "winxp"* ) version="xp" ;;
+ "win2003"* ) version="2k3" ;;
esac
- if [ -n "$legacy" ]; then
- if ! legacyInstall "$iso" "$dir" "$desc" "$legacy"; then
+ if [ -n "$version" ]; then
+
+ if ! legacyInstall "$iso" "$dir" "$desc" "$version"; then
error "Failed to prepare $desc ISO!"
return 1
fi
+
fi
if isLegacy "$id"; then
+
writeState "mode" "windows_legacy" || return 1
+
+ case "${id,,}" in
+ "win9"* | "win2k"* | "reactos" )
+ writeState "vga" "cirrus" || return 1 ;;
+ * )
+ writeState "vga" "std" || return 1 ;;
+ esac
+
fi
restoreBootMode || return 1
@@ -806,16 +822,14 @@ setMachine() {
"win9"* )
- writeState "usb" "no" || return 1
+ writeState "usb" "N" || return 1
writeState "net" "pcnet" || return 1
writeState "type" "auto" || return 1
- writeState "vga" "cirrus" || return 1
writeState "old" "pc-i440fx-2.4" || return 1 ;;
"win2k"* )
writeState "old" "pc" || return 1
- writeState "vga" "cirrus" || return 1
writeState "type" "auto" || return 1
writeState "net" "rtl8139" || return 1
writeState "usb" "pci-ohci" || return 1 ;;
@@ -832,7 +846,6 @@ setMachine() {
writeState "old" "pc" || return 1
writeState "type" "auto" || return 1
- writeState "vga" "cirrus" || return 1
writeState "net" "rtl8139" || return 1
writeState "usb" "pci-ohci" || return 1 ;;
@@ -1128,12 +1141,11 @@ addDrivers() {
mkdir -p "$dst" || return 1
cp -Lr "$dest/." "$dst" || return 1
- case "${version,,}" in
- "win11x64"* | "win2025"* )
- # Workaround Virtio GPU driver bug
- rm -rf "$dest/viogpudo"
- ;;
- esac
+ # Install the VirtIO display driver explicitly from SetupComplete.cmd so it
+ # cannot disrupt Windows Setup by loading through the WinPE driver path.
+ if ! isLegacy "$version"; then
+ rm -rf "$dest/viogpudo"
+ fi
if [ -n "$file" ]; then
@@ -1200,6 +1212,7 @@ updateImage() {
local bak="${xml//.xml/.org}"
local dat="${xml//.xml/.dat}"
local desc path src wim name info
+ local script=""
skipVersion "${DETECTED,,}" && return 0
@@ -1279,12 +1292,23 @@ updateImage() {
fi
fi
+ if ! updateDiskID "$answer" "${DISK_TYPE:-}" "image"; then
+ error "Failed to adjust the Windows installation disk!"
+ exit 85
+ fi
+
validateGeneratedXML "$answer" || return 1
+ if [ -z "${CUSTOM_XML:-}" ]; then
+ prepareSetupScript "$asset" "$tmp/setup" script || exit 84
+ fi
+
if ! wimlib-imagex update "$wim" "$idx" --command "add $answer /$xml" > /dev/null; then
MANUAL="Y"
warn "failed to add answer file ($name) to ISO image, $FB"
else
+ installSetupScript "$script" "$src" || exit 84
+
wimlib-imagex update "$wim" "$idx" --command "add $answer /$dat" > /dev/null || true
fi
@@ -1338,6 +1362,19 @@ removeImage() {
return 0
}
+reserveSambaPorts() {
+
+ disabled "${SAMBA:-Y}" && return 0
+ disabled "${NETWORK:-Y}" && return 0
+ enabled "${DHCP:-N}" && return 0
+
+ # NAT can fall back to user-mode networking after this point,
+ # so always protect the Samba listeners for non-DHCP networking.
+ HOST_PORTS="${HOST_PORTS:+$HOST_PORTS,}139/tcp,445/tcp"
+
+ return 0
+}
+
backup () {
local iso="$1"
@@ -1450,6 +1487,6 @@ restoreMachineState() {
return 0
}
-installWindows
+startWindows
return 0
diff --git a/src/mido.sh b/src/mido.sh
index b1f98a0b..cd495a34 100644
--- a/src/mido.sh
+++ b/src/mido.sh
@@ -577,6 +577,8 @@ getWindows() {
local language edition
MIDO_SOURCE=""
+ MIDO_STATIC="N"
+
language=$(getLanguage "$lang" "desc")
edition=$(printEdition "$version" "$desc" "Y")
@@ -648,6 +650,8 @@ getWindows() {
MIDO_URL=$(getMido "$version" "$lang" "")
[ -z "$MIDO_URL" ] && return 1
+ MIDO_STATIC="Y"
+
if [[ "${version,,}" == "win2008r2"* ]]; then
MIDO_SOURCE="win2008r2-eval"
return 0
@@ -1143,13 +1147,18 @@ downloadImage() {
sum=""
size=""
- # Skip verification if the retrieved URL differs from the static URL.
+ # Apply the metadata belonging to the configured static URL.
if [[ "${MIDO_URL%%\?*}" == "${url%%\?*}" ]]; then
size=$(getMido "$version" "$lang" "size")
sum=$(getMido "$version" "$lang" "sum")
fi
- if tryDownload "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" "$seconds" "$web_desc"; then
+ local download_desc="$desc"
+ if enabled "$MIDO_STATIC"; then
+ download_desc+=" using a static link"
+ fi
+
+ if tryDownload "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$download_desc" "$seconds" "$web_desc"; then
# Commit the candidate only after the image was downloaded and verified.
DETECTED="$detected"
return 0
diff --git a/src/power.sh b/src/power.sh
index 782f21f3..e070706c 100644
--- a/src/power.sh
+++ b/src/power.sh
@@ -76,6 +76,10 @@ bootStatus() {
'BdsDxe: failed to start Boot[[:xdigit:]]{4} "UEFI QEMU .*DVD-ROM.*: Time out' \
<<< "$recent" && return 2
+ grep -Fq \
+ "BdsDxe: No bootable option or device was found." \
+ <<< "$recent" && return 2
+
grep -Fq "UEFI Interactive Shell" <<< "$recent" && return 2
grep -Eq \
@@ -104,9 +108,17 @@ waitForBoot() {
if (( ! keySent )) && needsBootKey; then
if keyDelay=$(bootKeyDelay); then
- if sendKey spc "$keyDelay" 500; then
- keySent=1
+
+ if [[ "$keyDelay" == "0" ]]; then
+ if sendKey spc 0 500; then
+ keySent=1
+ fi
+ else
+ if sendKey spc "$keyDelay" 250 4 0.75; then
+ keySent=1
+ fi
fi
+
fi
fi
@@ -239,14 +251,23 @@ sendKey() {
local key="$1"
local delay="${2:-0}"
local hold="${3:-100}"
- local output
+ local repeat="${4:-1}"
+ local interval="${5:-0}"
+ local i output
[ ! -S "$ACPI_SOCKET" ] && return 1
[[ "$delay" != "0" ]] && sleep "$delay"
if ! output=$(
- printf 'sendkey %s %s\n' "$key" "$hold" |
- nc -q 1 -w 1 -U "$ACPI_SOCKET" 2>&1
+ {
+ for ((i = 1; i <= repeat; i++)); do
+ printf 'sendkey %s %s\n' "$key" "$hold"
+
+ if (( i < repeat )); then
+ sleep "$interval"
+ fi
+ done
+ } | nc -q 1 -w 1 -U "$ACPI_SOCKET" 2>&1
); then
return 1
fi