diff --git a/lib/images/windows/templates/essentials/windows-update.nix b/lib/images/windows/templates/essentials/windows-update.nix index 2e4d76e..5b3e188 100644 --- a/lib/images/windows/templates/essentials/windows-update.nix +++ b/lib/images/windows/templates/essentials/windows-update.nix @@ -94,6 +94,9 @@ :: Copy script to a path the wrapper won't delete copy /y "%~f0" "C:\vmix-update-continue.cmd" >nul reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v vmixUpdate /t REG_SZ /d "cmd /c C:\vmix-update-continue.cmd" /f + :: Preserve Audit Mode across reboot (updates can reset it) + reg add "HKLM\SYSTEM\Setup\Status\AuditBoot" /v AuditBoot /t REG_DWORD /d 1 /f + reg add "HKLM\SYSTEM\Setup" /v AuditInProgress /t REG_DWORD /d 1 /f :: Immediate reboot (preempts wrapper shutdown) shutdown /r /f /t 0 exit /b diff --git a/lib/images/windows/templates/generalize.nix b/lib/images/windows/templates/generalize.nix index 9b2a222..6ff6c0a 100644 --- a/lib/images/windows/templates/generalize.nix +++ b/lib/images/windows/templates/generalize.nix @@ -81,14 +81,21 @@ in powershell -Command "Get-AppxPackage *MicrosoftEdgeDevToolsClient* | Remove-AppxPackage -ErrorAction SilentlyContinue" - :: Activate Windows using TSforge (hardware-independent, survives VM migration) + :: Re-install product key to restore licensing after sysprep + cscript //nologo C:\Windows\System32\slmgr.vbs /ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D + cscript //nologo C:\Windows\System32\slmgr.vbs /rilc + :: Restart SPP service and wait for it to settle + net stop sppsvc /y 2>nul + net start sppsvc + ping -n 10 127.0.0.1 >nul + :: Activate Windows using TSforge if exist C:\MAS_AIO.cmd ( echo. | call C:\MAS_AIO.cmd /Z-Windows ) :: Activate Office using Ohook method (if Office is installed) if exist "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" ( if exist C:\MAS_AIO.cmd ( - echo. | call C:\MAS_AIO.cmd /Ohook + echo. | call C:\MAS_AIO.cmd /Ohook >> C:\vmix-activation.log 2>&1 ) ) del /q C:\MAS_AIO.cmd 2>nul