Image

Image

Search This Blog

Thursday, June 05, 2025

Make Win 10 or 11 Pro / Ent LTSC

@echo off

:: first go get the skus.zip - in the issues are the ones for W11 too
echo  Starting conversion to LTSC... 

:: If not launched as admin, relaunch
net.exe session 2>NUL 1>&2
if not %errorlevel%==0 (echo  You are NOT ADMIN. Relaunching... 
powershell Start -File "cmd '/K %~f0 runas'" -Verb RunAs
goto out)

:start
    pushd "%CD%"
    CD /D "%~dp0"
    echo  Take ownership of the skus subfolders 
    "%windir%\system32\takeown.exe" /F "%windir%\system32\spp\tokens\skus\csvlk-pack" /R /A /D Y
    "%windir%\system32\icacls.exe" "%windir%\system32\spp\tokens\skus\csvlk-pack" /T /grant Administrators:F
    "%windir%\system32\takeown.exe" /F "%windir%\system32\spp\tokens\skus\IoTEnterpriseS" /R /A /D Y
    "%windir%\system32\icacls.exe" "%windir%\system32\spp\tokens\skus\IoTEnterpriseS" /T /grant Administrators:F
    "%windir%\system32\takeown.exe" /F "%windir%\system32\spp\tokens\skus\IoTEnterpriseSK" /R /A /D Y
    "%windir%\system32\icacls.exe" "%windir%\system32\spp\tokens\skus\IoTEnterpriseSK" /T /grant Administrators:F
    "%windir%\system32\takeown.exe" /F "%windir%\System32\spp\tokens\EnterpriseS" /R /A /D Y
    "%windir%\system32\icacls.exe" "%windir%\system32\spp\tokens\skus\EnterpriseS" /T /grant Administrators:F
    echo. 

    echo  Extract and copy the new skus 
    FOR /F "tokens=1,2,3 delims= " %%A IN ('wmic os get Caption') DO @IF %%C EQU 10 "%windir%\System32\tar.exe" -v -x -f skus10.zip -C %windir%\system32\spp\tokens\skus
    FOR /F "tokens=1,2,3 delims= " %%A IN ('wmic os get Caption') DO @IF %%C EQU 11 "%windir%\System32\tar.exe" -v -x -f skus11.zip -C %windir%\system32\spp\tokens\skus
    
    echo  Reinstall the new licenses - be patient, this will take a minute 
    cscript.exe %windir%\system32\slmgr.vbs /rilc
    echo  Uninstall the actual product key 
    cscript.exe %windir%\system32\slmgr.vbs /upk
    echo  Remove the KMS 
    cscript.exe %windir%\system32\slmgr.vbs /ckms
    echo  Remove the old product key from registry 
    cscript.exe %windir%\system32\slmgr.vbs /cpky
    echo  Install LTSC Product key 
    :: use key from https://learn.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys - it requires a KMS Server, otherwise you will have to manually change the license from KMS to MAK
    cscript.exe %windir%\system32\slmgr.vbs /ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D
   

:end
    :: cleanup
    del /f /q "skus*.zip" 2>nul
    :: check the Windows version
    wmic os get Caption | findstr "Microsoft"
    echo  Now we should reboot... 
    choice /t 30 /c yn /d n /n /m "press  "Y"  in the next 30 seconds if you want to reboot"
    if errorlevel 2 goto :out
    if errorlevel 1 shutdown.exe -r -f -t 0

:out
    :: reset the colors
    echo.

Blog Archive