mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2024-11-22 23:56:47 +00:00
Compare commits
4 Commits
a421b12ae4
...
6c71e82ef3
Author | SHA1 | Date | |
---|---|---|---|
|
6c71e82ef3 | ||
|
66e8cda508 | ||
|
98027af16d | ||
|
be45752a21 |
@ -363,6 +363,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "regedition=%%a"
|
||||||
|
if /i not "%osedition%"=="%regedition%" (
|
||||||
|
set "showeditionerror=call :dk_color %_Yellow% "Mismatch found [WMI-%osedition%] [Reg-%regedition%].""
|
||||||
|
)
|
||||||
|
|
||||||
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "dismedition=%%a"
|
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "dismedition=%%a"
|
||||||
if not defined dismedition set dismnotworking=1
|
if not defined dismedition set dismnotworking=1
|
||||||
|
|
||||||
@ -439,6 +444,7 @@ set targetedition=
|
|||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Gray% "You can change the Edition [%osedition%] [%fullbuild%] to one of the following."
|
call :dk_color %Gray% "You can change the Edition [%osedition%] [%fullbuild%] to one of the following."
|
||||||
|
%showeditionerror%
|
||||||
if defined dismnotworking (
|
if defined dismnotworking (
|
||||||
call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
||||||
if /i "%osedition:~0,4%"=="Core" call :dk_color %_Yellow% " - You will see more edition options to choose once its changed to Pro."
|
if /i "%osedition:~0,4%"=="Core" call :dk_color %_Yellow% " - You will see more edition options to choose once its changed to Pro."
|
||||||
@ -536,6 +542,7 @@ if defined rebootreq goto dk_done
|
|||||||
cls
|
cls
|
||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
|
%showeditionerror%
|
||||||
if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not working."
|
if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not working."
|
||||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
||||||
echo:
|
echo:
|
||||||
@ -605,6 +612,7 @@ call :ced_rebootflag
|
|||||||
if defined rebootreq goto dk_done
|
if defined rebootreq goto dk_done
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
|
%showeditionerror%
|
||||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
||||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
||||||
echo:
|
echo:
|
||||||
@ -661,6 +669,7 @@ if defined rebootreq goto dk_done
|
|||||||
|
|
||||||
cls
|
cls
|
||||||
echo:
|
echo:
|
||||||
|
%showeditionerror%
|
||||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
||||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
||||||
echo:
|
echo:
|
||||||
@ -673,6 +682,9 @@ echo DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
|
|||||||
DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
|
DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
|
||||||
|
|
||||||
call :ced_postprep
|
call :ced_postprep
|
||||||
|
%line%
|
||||||
|
|
||||||
|
goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@ -684,7 +696,7 @@ set preperror=
|
|||||||
for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time=%%a
|
for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time=%%a
|
||||||
|
|
||||||
%psc% Stop-Service TrustedInstaller -force %nul%
|
%psc% Stop-Service TrustedInstaller -force %nul%
|
||||||
%psc% Stop-Service TrustedInstaller -force %nul%
|
timeout /t 5 %nul1%
|
||||||
|
|
||||||
sc query TrustedInstaller | find /i "RUNNING" %nul% && (
|
sc query TrustedInstaller | find /i "RUNNING" %nul% && (
|
||||||
%eline%
|
%eline%
|
||||||
@ -711,13 +723,15 @@ exit /b
|
|||||||
:ced_postprep
|
:ced_postprep
|
||||||
|
|
||||||
timeout /t 5 %nul1%
|
timeout /t 5 %nul1%
|
||||||
|
copy /y /b "%SystemRoot%\logs\cbs\cbs.log" "%SystemRoot%\logs\cbs\cbs_%_time%.log" %nul%
|
||||||
|
copy /y /b "%SystemRoot%\logs\DISM\dism.log" "%SystemRoot%\logs\DISM\dism_%_time%.log" %nul%
|
||||||
|
|
||||||
if not exist "!desktop!\ChangeEdition_Logs\" md "!desktop!\ChangeEdition_Logs\" %nul%
|
if not exist "!desktop!\ChangeEdition_Logs\" md "!desktop!\ChangeEdition_Logs\" %nul%
|
||||||
copy /y /b "%SystemRoot%\logs\cbs\cbs.log" "!desktop!\ChangeEdition_Logs\CBS_%_time%.log" %nul%
|
call :compresslog cbs\cbs_%_time%.log ChangeEdition_Logs\CBS %nul%
|
||||||
copy /y /b "%SystemRoot%\logs\DISM\dism.log" "!desktop!\ChangeEdition_Logs\DISM_%_time%.log" %nul%
|
call :compresslog DISM\dism_%_time%.log ChangeEdition_Logs\DISM %nul%
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Log files are copied to the ChangeEdition_Logs folder on the dekstop.
|
echo Log files are copied to the ChangeEdition_Logs folder on the desktop.
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Blue% "In case of errors, you must restart your system before trying again."
|
call :dk_color %Blue% "In case of errors, you must restart your system before trying again."
|
||||||
echo:
|
echo:
|
||||||
@ -725,6 +739,36 @@ set fixes=%fixes% %mas%change_edition_issues
|
|||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
:compresslog
|
||||||
|
|
||||||
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
|
set "ddf="%SystemRoot%\Temp\ddf""
|
||||||
|
%nul% del /q /f %ddf%
|
||||||
|
echo/.New Cabinet>%ddf%
|
||||||
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
|
echo/.set CabinetFileCountThreshold=0;>>%ddf%
|
||||||
|
echo/.set Compress=ON>>%ddf%
|
||||||
|
echo/.set CompressionType=LZX>>%ddf%
|
||||||
|
echo/.set CompressionLevel=7;>>%ddf%
|
||||||
|
echo/.set CompressionMemory=21;>>%ddf%
|
||||||
|
echo/.set FolderFileCountThreshold=0;>>%ddf%
|
||||||
|
echo/.set FolderSizeThreshold=0;>>%ddf%
|
||||||
|
echo/.set GenerateInf=OFF>>%ddf%
|
||||||
|
echo/.set InfFileName=nul>>%ddf%
|
||||||
|
echo/.set MaxCabinetSize=0;>>%ddf%
|
||||||
|
echo/.set MaxDiskFileCount=0;>>%ddf%
|
||||||
|
echo/.set MaxDiskSize=0;>>%ddf%
|
||||||
|
echo/.set MaxErrors=1;>>%ddf%
|
||||||
|
echo/.set RptFileName=nul>>%ddf%
|
||||||
|
echo/.set UniqueFiles=ON>>%ddf%
|
||||||
|
for /f "tokens=* delims=" %%D in ('dir /a:-D/b/s "%SystemRoot%\logs\%1"') do (
|
||||||
|
echo/"%%~fD" /inf=no;>>%ddf%
|
||||||
|
)
|
||||||
|
makecab /F %ddf% /D DiskDirectory1="" /D CabinetNameTemplate="!desktop!\%2_%_time%.cab"
|
||||||
|
del /q /f %ddf%
|
||||||
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Set variables
|
:: Set variables
|
||||||
|
Loading…
Reference in New Issue
Block a user