mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-01-13 11:31:47 +00:00
Compare commits
55 Commits
3.2
...
9c09432b01
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c09432b01 | |||
| e476ac66a4 | |||
| dba7213a91 | |||
| 0f38fa3cef | |||
| 2dd41cc2c5 | |||
| d78e262f5b | |||
| fd1e146753 | |||
| bc781ad079 | |||
| 43cceb366e | |||
| 39bcefa02b | |||
| 2b37400aa8 | |||
| 1fb65d4f9c | |||
| 10b6e8b6dc | |||
| cb36c19f01 | |||
| 4aa811dd5e | |||
| 5d37a99966 | |||
| 64a726202c | |||
| c3e70173e4 | |||
| c817ae8bd9 | |||
| ef411e14ca | |||
| 5aa7d4f3de | |||
| 409c4f71ad | |||
| d7a6994363 | |||
| 5ad6226f37 | |||
| ae9f4e34ff | |||
| 67abcd0c89 | |||
| faf3bf3a08 | |||
| 482600c890 | |||
| dc90e1ff0f | |||
| f969378f6b | |||
| c89bebdee8 | |||
| be7d101df5 | |||
| 55b6fce50a | |||
| 6566bb53c1 | |||
| 2e44a4a77b | |||
| 9073a35fe0 | |||
| 9f244ddc17 | |||
| 8ed0c6874b | |||
| a99acbb025 | |||
| be867f6616 | |||
| fc80735dac | |||
| 69c469a997 | |||
| 6e74d49721 | |||
| ae93f547f5 | |||
| 830755f6b6 | |||
| a149fc5f20 | |||
| b75ba72bc5 | |||
| 206c31ece5 | |||
| 133d3b9720 | |||
| fc2348bf53 | |||
| 966fbd14f6 | |||
| 691e6088d5 | |||
| 74b7c74218 | |||
| 4c53e6231b | |||
| 2d00dfa704 |
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -1,4 +1,4 @@
|
|||||||
MAS export-ignore
|
# MAS export-ignore
|
||||||
LICENSE export-ignore
|
# LICENSE export-ignore
|
||||||
README.md export-ignore
|
# README.md export-ignore
|
||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
@set masver=3.2
|
@set masver=3.4
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::============================================================================
|
::============================================================================
|
||||||
::
|
::
|
||||||
:: Homepage: mass grave[.]dev
|
:: Homepage: mass<>grave<.>dev
|
||||||
:: Email: mas.help@outlook.com
|
:: Email: mas.help@outlook.com
|
||||||
::
|
::
|
||||||
::============================================================================
|
::============================================================================
|
||||||
@ -100,6 +100,8 @@ set "nul="
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||||
|
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||||
|
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||||
|
|
||||||
:: Check if Null service is working, it's important for the batch script
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -171,6 +173,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not exist "%SysPath%\logoff.exe" (
|
||||||
|
sc query gcs | find /i "RUNNING" %nul% && (
|
||||||
|
%eline%
|
||||||
|
echo Windows Sandbox detected; activation is not required.
|
||||||
|
echo The script cannot run due to missing licensing components. Aborting...
|
||||||
|
echo:
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 10240 (
|
if %winbuild% LSS 10240 (
|
||||||
%eline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
@ -235,16 +247,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
REM check LanguageMode
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -274,7 +288,17 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
echo:
|
||||||
|
sc query sense | find /i "RUNNING" %nul% && (
|
||||||
|
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||||
|
)
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -295,7 +319,9 @@ set terminal=
|
|||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set lines=0
|
set lines=0
|
||||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||||
|
for %%B in (%%A) do set lines=%%B
|
||||||
|
)
|
||||||
if !lines! GEQ 100 set terminal=
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -356,7 +382,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -495,7 +521,7 @@ set notworking=
|
|||||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if defined allapps call :hwiddata key
|
if defined allapps call :hwiddata key
|
||||||
if not defined key (
|
if not defined key (
|
||||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getactivationid\:.*';iex ($f[1])"') do (set altapplist=%%a)
|
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';. ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a)
|
||||||
if defined altapplist call :hwiddata key
|
if defined altapplist call :hwiddata key
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -553,12 +579,15 @@ call :dk_inskey "[%key%]"
|
|||||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b"
|
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b"
|
||||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b"
|
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b"
|
||||||
|
|
||||||
set regionchange=
|
:: Skip changing region in top countries
|
||||||
if not "%name%"=="US" (
|
|
||||||
set regionchange=1
|
set regionchange=1
|
||||||
|
for %%# in (US CN IN BR DE JP GB FR MX ID IT PK TR KR CA ES AU NG VN PL PH NL EG AR TH CO SA TW MY CL) do if /i "%name%"=="%%#" set regionchange=
|
||||||
|
|
||||||
|
if defined regionchange (
|
||||||
%psc% "Set-WinHomeLocation -GeoId 244" %nul%
|
%psc% "Set-WinHomeLocation -GeoId 244" %nul%
|
||||||
if !errorlevel! EQU 0 (
|
if !errorlevel! EQU 0 (
|
||||||
echo Changing Windows Region To USA [Successful]
|
echo Changing Windows Region To USA [Successful] [Script will change it back]
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Red% "Changing Windows Region To USA [Failed]"
|
call :dk_color %Red% "Changing Windows Region To USA [Failed]"
|
||||||
)
|
)
|
||||||
@ -906,7 +935,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
|
|||||||
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||||
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||||
|
|
||||||
if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && (
|
if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && (
|
||||||
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
|
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
|
||||||
set winsub=1
|
set winsub=1
|
||||||
set osSKU=%regSKU%
|
set osSKU=%regSKU%
|
||||||
@ -1171,7 +1200,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
|
|||||||
if not "%results%%pupfound%"=="" (
|
if not "%results%%pupfound%"=="" (
|
||||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
if defined results call :dk_color %Red% "%results%"
|
if defined results (call :dk_color %Red% "%results%"&set showfix=1)
|
||||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
@ -1192,40 +1221,118 @@ exit /b
|
|||||||
set showfix=
|
set showfix=
|
||||||
call :dk_chkmal
|
call :dk_chkmal
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
:: Check Sandboxing
|
:: Check Sandboxing
|
||||||
|
|
||||||
sc query Null %nul% || (
|
sc query Null %nul% || (
|
||||||
set error=1
|
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly]"
|
||||||
set showfix=1
|
if not defined showfix (
|
||||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
echo:
|
||||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::==============================
|
||||||
|
|
||||||
|
:: Check WinPE mode
|
||||||
|
|
||||||
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
|
||||||
|
|
||||||
|
call :dk_color %Red% "Checking WinPE [Found]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "WinPE mode found. Reboot the system and run in normal mode."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check Safe mode
|
||||||
|
|
||||||
|
if defined safeboot_option (
|
||||||
|
call :dk_color %Red% "Checking Boot Mode [%safeboot_option%]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Safe mode found. Reboot the system and run in normal mode."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check ImageState
|
||||||
|
:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states
|
||||||
|
|
||||||
|
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||||
|
|
||||||
|
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||||
|
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||||
|
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
:: Check corrupt services
|
:: Check corrupt services
|
||||||
|
|
||||||
set serv_cor=
|
set serv_cor=
|
||||||
for %%# in (%_serv%) do (
|
for %%# in (%_serv%) do (
|
||||||
|
set _regcorr=
|
||||||
set _corrupt=
|
set _corrupt=
|
||||||
sc start %%# %nul%
|
sc start %%# %nul%
|
||||||
if !errorlevel! EQU 1060 set _corrupt=1
|
if !errorlevel! EQU 1060 set _corrupt=1
|
||||||
sc query %%# %nul% || set _corrupt=1
|
sc query %%# %nul% || set _corrupt=1
|
||||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _regcorr (
|
||||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1
|
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1&set _regcorr="-RegistryError" )
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (set "serv_cor=%%#"))
|
if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#!_regcorr!") else (set "serv_cor=%%#!_regcorr!"))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined serv_cor (
|
if defined serv_cor (
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||||
|
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
if /i "%serv_cor%"=="sppsvc-RegistryError" (
|
||||||
|
set fixes=%fixes% %mas%fix_service
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||||
|
) else (
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
)
|
||||||
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
:: Check disabled services
|
:: Check disabled services
|
||||||
|
|
||||||
@ -1260,11 +1367,26 @@ if defined serv_cste (set "serv_cste=!serv_cste! %%#") else (set "serv_cste=%%#"
|
|||||||
if defined serv_csts call :dk_color %Gray% "Enabling Disabled Services [Successful] [%serv_csts%]"
|
if defined serv_csts call :dk_color %Gray% "Enabling Disabled Services [Successful] [%serv_csts%]"
|
||||||
|
|
||||||
if defined serv_cste (
|
if defined serv_cste (
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Enabling Disabled Services [Failed] [%serv_cste%]"
|
call :dk_color %Red% "Enabling Disabled Services [Failed] [%serv_cste%]"
|
||||||
|
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
echo %serv_cste% | findstr /i "ClipSVC sppsvc" %nul% && (
|
||||||
|
echo A registry fix has been applied to enable the disabled service.
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||||
|
) || (
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
)
|
||||||
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
:: Check if the services are able to run or not
|
:: Check if the services are able to run or not
|
||||||
:: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions
|
:: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions
|
||||||
@ -1286,75 +1408,313 @@ if defined checkerror if defined serv_e (set "serv_e=!serv_e!, %%#-!errorcode!")
|
|||||||
)
|
)
|
||||||
|
|
||||||
if defined serv_e (
|
if defined serv_e (
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
|
||||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
if not defined showfix (
|
||||||
|
set listwospp=%_serv:sppsvc=%
|
||||||
|
echo %serv_e% | findstr /i "!listwospp!" %nul% && (
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
echo:
|
||||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
|
||||||
set fixes=%fixes% %mas%fix_service
|
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
|
||||||
set showfix=1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Various error checks
|
|
||||||
|
|
||||||
if defined safeboot_option (
|
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option%] " %Blue% "[Safe mode found. Run in normal mode.]"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
|
||||||
|
|
||||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
|
||||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
|
||||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
|
||||||
)
|
|
||||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
|
||||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
call :dk_color2 %Blue% "If service error is still not fixed, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
echo:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
set error=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
|
:: Check WMI
|
||||||
|
|
||||||
|
set wmifailed=
|
||||||
|
if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
|
||||||
|
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||||
|
|
||||||
|
if %errorlevel% NEQ 0 set wmifailed=1
|
||||||
|
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||||
|
|
||||||
|
if defined wmifailed (
|
||||||
|
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||||
|
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
set wpainfo=
|
:: Check SPP Registry Key
|
||||||
set wpaerror=
|
|
||||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a)
|
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
set error=1
|
set error=1
|
||||||
set wpaerror=1
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check TokenStore registry key
|
||||||
|
|
||||||
|
set tokenstore=
|
||||||
|
if %winbuild% GEQ 7600 (
|
||||||
|
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b"
|
||||||
|
if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform"
|
||||||
|
|
||||||
|
if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" (
|
||||||
|
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set toerr=1
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: This code creates token folder only if it's missing and sets default permission for it
|
||||||
|
|
||||||
|
if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" (
|
||||||
|
|
||||||
|
mkdir "%tokenstore%" %nul%
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';"
|
||||||
|
if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';"
|
||||||
|
set "d=!d! $AclObject = New-Object System.Security.AccessControl.DirectorySecurity;"
|
||||||
|
set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
||||||
|
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||||
|
%psc% "!d!" %nul%
|
||||||
|
|
||||||
|
if exist "%tokenstore%\" (
|
||||||
|
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||||
|
) else (
|
||||||
|
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||||
|
|
||||||
|
set permerror=
|
||||||
|
if %winbuild% GEQ 9200 if not defined toerr if not defined ps32onArm if exist "%tokenstore%\" (
|
||||||
|
for %%# in (
|
||||||
|
"%tokenstore%+FullControl"
|
||||||
|
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||||
|
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||||
|
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||||
|
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||||
|
if !errorlevel!==2 (
|
||||||
|
if "%%A"=="%tokenstore%" (
|
||||||
|
set "permerror=Error Found In Token Folder"
|
||||||
|
) else (
|
||||||
|
set "permerror=Error Found In SPP Registries"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
|
if not defined permerror (
|
||||||
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
|
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
|
||||||
|
reg query "!pol!" %nul% || reg add "!pol!" %nul%
|
||||||
|
%psc% "$netServ = (New-Object Security.Principal.SecurityIdentifier('S-1-5-20')).Translate([Security.Principal.NTAccount]).Value; $aclString = Get-Acl 'Registry::!pol!' | Format-List | Out-String; if (-not ($aclString.Contains($netServ + ' Allow FullControl') -or $aclString.Contains('NT SERVICE\sppsvc Allow FullControl')) -or ($aclString.Contains('Deny'))) {Exit 3}" %nul%
|
||||||
|
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined permerror (
|
||||||
|
call :dk_color %Red% "Checking SPP Permissions [!permerror!]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check WPA Registry Errors
|
||||||
|
|
||||||
|
set chkalp=
|
||||||
|
set wpainfo=NotFound
|
||||||
|
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
|
||||||
|
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
|
||||||
|
|
||||||
|
if defined chkalp (
|
||||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||||
) || (
|
if not defined showfix (
|
||||||
|
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
|
||||||
|
echo:
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set wpainfo=a
|
||||||
|
)
|
||||||
|
|
||||||
|
if not defined chkalp (
|
||||||
|
if %wpainfo% GEQ 5000 (
|
||||||
|
call :dk_color %Gray% "Checking WPA Registry Count [%wpainfo%]"
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "A large number of WPA registries have been found, which may cause high CPU usage."
|
||||||
|
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
|
||||||
|
echo:
|
||||||
|
) else (
|
||||||
echo Checking WPA Registry Count [%wpainfo%]
|
echo Checking WPA Registry Count [%wpainfo%]
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check Rearm
|
||||||
|
|
||||||
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
|
||||||
|
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
|
||||||
|
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check SoftwareLicensingService
|
||||||
|
|
||||||
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
|
set error_code=%errorlevel%
|
||||||
|
cmd /c exit /b %error_code%
|
||||||
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
|
|
||||||
|
if %error_code% NEQ 0 (
|
||||||
|
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
|
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check Activation IDs
|
||||||
|
|
||||||
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
|
|
||||||
|
if not defined apps (
|
||||||
|
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||||
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
|
)
|
||||||
|
|
||||||
|
if not defined apps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
|
|
||||||
|
if not defined apps if defined allapps if not defined notwinact (
|
||||||
|
call :dk_color %Gray% "Checking Activation IDs [Key Not Installed or Act ID Not Found]"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not defined apps if not defined allapps (
|
||||||
|
call :dk_color %Red% "Checking Activation IDs [Not found]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
|
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||||
|
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check Eval Windows
|
||||||
|
|
||||||
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
call :dk_color %Red% "Checking Eval Packages [License swapping found. Non-Eval licenses are installed in Eval Windows]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "License swapping is not the right way to upgrade to the full version. Learn the correct method at the link below."
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check HKU\S-1-5-20\Software registry, in some systems it's missing and that causes Windows activation problems
|
||||||
|
|
||||||
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||||
|
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||||
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check license and package files for the current edition
|
||||||
|
|
||||||
set osedition=0
|
set osedition=0
|
||||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||||
@ -1374,12 +1734,10 @@ if not defined notwinact (
|
|||||||
if %osedition%==0 (
|
if %osedition%==0 (
|
||||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||||
) else (
|
) else (
|
||||||
|
|
||||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||||
set skunotfound=1
|
set skunotfound=1
|
||||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
|
||||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||||
@ -1388,31 +1746,9 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
:: Check SKU value to find if there is any difference
|
||||||
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
|
||||||
set error_code=%errorlevel%
|
|
||||||
cmd /c exit /b %error_code%
|
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
|
||||||
if %error_code% NEQ 0 (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
set wmifailed=
|
|
||||||
if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
|
|
||||||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
|
||||||
|
|
||||||
if %errorlevel% NEQ 0 set wmifailed=1
|
|
||||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
|
||||||
if defined wmifailed (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
|
||||||
if not defined showfix call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
|
||||||
set showfix=1
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if not defined notwinact (
|
if not defined notwinact (
|
||||||
if %winbuild% GEQ 10240 (
|
if %winbuild% GEQ 10240 (
|
||||||
@ -1430,19 +1766,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
|
::==============================
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
|
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||||
|
|
||||||
@ -1450,15 +1774,9 @@ if exist "%SysPath%\wlms\wlms.exe" (
|
|||||||
echo Checking Eval WLMS Service [Found]
|
echo Checking Eval WLMS Service [Found]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
:: Check SPP interference in IFEO
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
|
||||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
|
||||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||||
@ -1466,156 +1784,53 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu
|
|||||||
if defined _sppint (
|
if defined _sppint (
|
||||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
if not defined showfix (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
set showfix=1
|
set showfix=1
|
||||||
) || (
|
) || (
|
||||||
echo Checking SPP In IFEO [%_sppint%]
|
echo Checking SPP In IFEO [%_sppint%]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
|
:: Check and fix SkipRearm registry value
|
||||||
|
|
||||||
if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
call :dk_color %Gray% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
::==============================
|
||||||
|
|
||||||
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
:: Check SvcRestartTask status, this task helps in making sure system remains activated
|
||||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
|
||||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
set tokenstore=
|
|
||||||
if %winbuild% GEQ 7600 (
|
|
||||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b"
|
|
||||||
if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform"
|
|
||||||
if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" (
|
|
||||||
set toerr=1
|
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
|
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
:: This code creates token folder only if it's missing and sets default permission for it
|
|
||||||
|
|
||||||
if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" (
|
|
||||||
mkdir "%tokenstore%" %nul%
|
|
||||||
if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';"
|
|
||||||
if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';"
|
|
||||||
set "d=!d! $AclObject = New-Object System.Security.AccessControl.DirectorySecurity;"
|
|
||||||
set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|
||||||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
|
||||||
%psc% "!d!" %nul%
|
|
||||||
if exist "%tokenstore%\" (
|
|
||||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
|
||||||
) else (
|
|
||||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
|
||||||
set error=1
|
|
||||||
set showfix=1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if not defined notwinact (
|
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
|
||||||
if not defined apps (
|
|
||||||
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
|
||||||
if not defined apps (
|
|
||||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
|
||||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
|
||||||
if not defined allapps (
|
|
||||||
set error=1
|
|
||||||
set "_notfoundids=Not found"
|
|
||||||
)
|
|
||||||
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
|
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
|
||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
|
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
|
||||||
|
|
||||||
echo !taskinfo! | find /i "Ready" %nul% || (
|
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
|
||||||
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, system might deactivate later]"
|
||||||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
|
||||||
|
|
||||||
set permerror=
|
|
||||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
|
||||||
for %%# in (
|
|
||||||
"%tokenstore%+FullControl"
|
|
||||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
|
||||||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
|
||||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
|
||||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
|
||||||
if !errorlevel!==2 (
|
|
||||||
if "%%A"=="%tokenstore%" (
|
|
||||||
set "permerror=Error Found In Token Folder"
|
|
||||||
) else (
|
|
||||||
set "permerror=Error Found In SPP Registries"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
|
||||||
|
|
||||||
if not defined permerror (
|
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
|
||||||
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
|
|
||||||
reg query "!pol!" %nul% || reg add "!pol!" %nul%
|
|
||||||
%psc% "$netServ = (New-Object Security.Principal.SecurityIdentifier('S-1-5-20')).Translate([Security.Principal.NTAccount]).Value; $aclString = Get-Acl 'Registry::!pol!' | Format-List | Out-String; if (-not ($aclString.Contains($netServ + ' Allow FullControl') -or $aclString.Contains('NT SERVICE\sppsvc Allow FullControl')) -or ($aclString.Contains('Deny'))) {Exit 3}" %nul%
|
|
||||||
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined permerror (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking SPP Permissions [!permerror!]"
|
|
||||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
|
||||||
set showfix=1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
|
|
||||||
|
|
||||||
if not defined serv_cor if not defined serv_cste if defined error if /i not %error_code%==0 if not defined showfix (
|
|
||||||
if not defined permerror if defined wpaerror (call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option." & set showfix=1)
|
|
||||||
if not defined showfix (
|
if not defined showfix (
|
||||||
set showfix=1
|
echo:
|
||||||
call :dk_color %Blue% "%_fixmsg%"
|
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
|
||||||
if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined showfix if defined wpaerror (
|
::==============================
|
||||||
set showfix=1
|
|
||||||
call :dk_color %Blue% "If activation fails then go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
|
|
||||||
)
|
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1707,7 +1922,7 @@ call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
|||||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 exit /b
|
if !errorlevel!==2 exit /b
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
@ -1726,7 +1941,7 @@ exit /b
|
|||||||
:: 2nd column = Generic Retail/OEM/MAK Key
|
:: 2nd column = Generic Retail/OEM/MAK Key
|
||||||
:: 3rd column = SKU ID
|
:: 3rd column = SKU ID
|
||||||
:: 4th column = Key part number
|
:: 4th column = Key part number
|
||||||
:: 5th column = Ticket signature value. It's as it is, it's not encoded. (Check mass grave[.]dev/hwid#manual-activation to see how it's generated)
|
:: 5th column = Ticket signature value. It's as it is, it's not encoded. (Check mass<>grave<.>dev/hwid#manual-activation to see how it's generated)
|
||||||
:: 6th column = 1 = activation is not working (at the time of writing this), 0 = activation is working
|
:: 6th column = 1 = activation is not working (at the time of writing this), 0 = activation is working
|
||||||
:: 7th column = Key Type
|
:: 7th column = Key Type
|
||||||
:: 8th column = WMI Edition ID (For reference only)
|
:: 8th column = WMI Edition ID (For reference only)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
@set masver=3.2
|
@set masver=3.4
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::============================================================================
|
::============================================================================
|
||||||
::
|
::
|
||||||
:: Homepage: mass grave[.]dev
|
:: Homepage: mass<>grave<.>dev
|
||||||
:: Email: mas.help@outlook.com
|
:: Email: mas.help@outlook.com
|
||||||
::
|
::
|
||||||
::============================================================================
|
::============================================================================
|
||||||
@ -60,6 +60,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||||
|
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||||
|
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||||
|
|
||||||
:: Check if Null service is working, it's important for the batch script
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -133,6 +135,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not exist "%SysPath%\logoff.exe" (
|
||||||
|
sc query gcs | find /i "RUNNING" %nul% && (
|
||||||
|
%eline%
|
||||||
|
echo Windows Sandbox detected.
|
||||||
|
echo The script cannot run due to missing licensing components. Aborting...
|
||||||
|
echo:
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 7600 (
|
||||||
%eline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
@ -188,16 +200,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
REM check LanguageMode
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -227,7 +241,17 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
echo:
|
||||||
|
sc query sense | find /i "RUNNING" %nul% && (
|
||||||
|
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||||
|
)
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -248,7 +272,9 @@ set terminal=
|
|||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set lines=0
|
set lines=0
|
||||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||||
|
for %%B in (%%A) do set lines=%%B
|
||||||
|
)
|
||||||
if !lines! GEQ 100 set terminal=
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -309,7 +335,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -323,15 +349,6 @@ echo:
|
|||||||
echo Initializing...
|
echo Initializing...
|
||||||
echo:
|
echo:
|
||||||
|
|
||||||
if not exist %SysPath%\sppsvc.exe (
|
|
||||||
%eline%
|
|
||||||
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
|
|
||||||
echo:
|
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
set spp=SoftwareLicensingProduct
|
set spp=SoftwareLicensingProduct
|
||||||
@ -365,8 +382,7 @@ if %osedition%==0 (
|
|||||||
%eline%
|
%eline%
|
||||||
echo Failed to detect OS Edition. Aborting...
|
echo Failed to detect OS Edition. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -415,6 +431,7 @@ _updch
|
|||||||
_lang
|
_lang
|
||||||
_clversion
|
_clversion
|
||||||
_version
|
_version
|
||||||
|
_AudienceData
|
||||||
_oIds
|
_oIds
|
||||||
_c2rXml
|
_c2rXml
|
||||||
_c2rExe
|
_c2rExe
|
||||||
@ -542,9 +559,10 @@ goto :oe_edition
|
|||||||
:oe_editionchangepre
|
:oe_editionchangepre
|
||||||
|
|
||||||
cls
|
cls
|
||||||
|
set editedition=
|
||||||
call :ch_getinfo
|
call :ch_getinfo
|
||||||
call :oe_tempcleanup
|
call :oe_tempcleanup
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])"
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
|
|
||||||
:oe_editionchange
|
:oe_editionchange
|
||||||
|
|
||||||
@ -618,7 +636,7 @@ cls
|
|||||||
set suites=
|
set suites=
|
||||||
echo %list% | find /i "Suites" %nul1% && (
|
echo %list% | find /i "Suites" %nul1% && (
|
||||||
set suites=1
|
set suites=1
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getappnames\:.*';iex ($f[1])"
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
if not exist %SystemRoot%\Temp\getAppIds.txt (
|
if not exist %SystemRoot%\Temp\getAppIds.txt (
|
||||||
%eline%
|
%eline%
|
||||||
echo Failed to generate available apps list.
|
echo Failed to generate available apps list.
|
||||||
@ -660,7 +678,8 @@ if not defined terminal mode 98, 32
|
|||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Gray% "Target edition: %targetedition%"
|
call :dk_color %Gray% "Target edition: %targetedition%"
|
||||||
call :dk_color %Gray% "You can exclude the below apps from installation."
|
call :dk_color %Gray% "To exclude the apps listed below from installation, toggle them from On to Off."
|
||||||
|
if defined editedition call :dk_color %Gray% "Note: The On/Off status below does not reflect the current status of the installed apps."
|
||||||
%line%
|
%line%
|
||||||
if defined suites echo:
|
if defined suites echo:
|
||||||
if defined Access_st echo [A] Access : %Access_st%
|
if defined Access_st echo [A] Access : %Access_st%
|
||||||
@ -787,7 +806,9 @@ goto :oe_goback
|
|||||||
:: OfficeClickToRun.exe with productstoadd method is used here to add editions
|
:: OfficeClickToRun.exe with productstoadd method is used here to add editions
|
||||||
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
|
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
|
||||||
|
|
||||||
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
|
call :oe_getlangs
|
||||||
|
|
||||||
|
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
|
||||||
|
|
||||||
if %change%==1 (
|
if %change%==1 (
|
||||||
set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
|
set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
|
||||||
@ -802,8 +823,40 @@ set errorcode=%errorlevel%
|
|||||||
timeout /t 10 %nul%
|
timeout /t 10 %nul%
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
|
set suggestchannel=
|
||||||
|
|
||||||
if %errorcode% EQU 0 (
|
if %errorcode% EQU 0 (
|
||||||
call :dk_color %Gray% "Now run the Office activation option from the main menu."
|
if %change%==1 (
|
||||||
|
echo %targetedition% | find /i "2019Volume" %nul% && (
|
||||||
|
if not defined ltsc19 set suggestchannel=Production::LTSC
|
||||||
|
if /i not %_AudienceData%==Production::LTSC set suggestchannel=Production::LTSC
|
||||||
|
if /i not %_updch%==F2E724C1-748F-4B47-8FB8-8E0D210E9208 set suggestchannel=Production::LTSC
|
||||||
|
)
|
||||||
|
|
||||||
|
echo %targetedition% | find /i "2021Volume" %nul% && (
|
||||||
|
if not defined ltsc21 set suggestchannel=Production::LTSC2021
|
||||||
|
if /i not %_AudienceData%==Production::LTSC2021 set suggestchannel=Production::LTSC2021
|
||||||
|
if /i not %_updch%==5030841D-C919-4594-8D2D-84AE4F96E58E set suggestchannel=Production::LTSC2021
|
||||||
|
)
|
||||||
|
|
||||||
|
echo %targetedition% | find /i "2024Volume" %nul% && (
|
||||||
|
if not defined ltsc24 set suggestchannel=Production::LTSC2024
|
||||||
|
if /i not %_AudienceData%==Production::LTSC2024 set suggestchannel=Production::LTSC2024
|
||||||
|
if /i not %_updch%==7983BAC0-E531-40CF-BE00-FD24FE66619C set suggestchannel=Production::LTSC2024
|
||||||
|
)
|
||||||
|
|
||||||
|
echo %targetedition% | findstr /R "20.*Volume" %nul% || (
|
||||||
|
if defined ltscfound set suggestchannel=Production::CC
|
||||||
|
echo %_AudienceData% | find /i "LTSC" %nul% && set suggestchannel=Production::CC
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined suggestchannel (
|
||||||
|
call :dk_color %Gray% "Mismatch found in update channel and installed product."
|
||||||
|
call :dk_color %Blue% "It is recommended to change the update channel to [!suggestchannel!] from the previous menu."
|
||||||
|
)
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
call :dk_color %Gray% "To activate Office, run the activation option from the main menu."
|
||||||
) else (
|
) else (
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -827,6 +880,7 @@ goto :oe_goback
|
|||||||
)
|
)
|
||||||
|
|
||||||
set change=0
|
set change=0
|
||||||
|
set editedition=1
|
||||||
call :ch_getinfo
|
call :ch_getinfo
|
||||||
cls
|
cls
|
||||||
|
|
||||||
@ -932,13 +986,8 @@ if %verified%==0 goto :oe_removeedition
|
|||||||
cls
|
cls
|
||||||
if not defined terminal mode 105, 32
|
if not defined terminal mode 105, 32
|
||||||
|
|
||||||
set _lang=
|
call :oe_getlangs %targetedition%
|
||||||
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9)
|
set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16_%_allLangs%"
|
||||||
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%targetedition%.16" /f "-" /k ^| findstr /i ".*16\\.*-.*"') do (
|
|
||||||
if defined _lang (set "_lang=!_lang!_%%a") else (set "_lang=_%%a")
|
|
||||||
)
|
|
||||||
|
|
||||||
set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16%_lang%"
|
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Running the below command, please wait...
|
echo Running the below command, please wait...
|
||||||
@ -980,6 +1029,12 @@ echo Installed Office editions: %_oIds%
|
|||||||
echo Unsupported Office edition is installed on your Windows build version %winbuild%.
|
echo Unsupported Office edition is installed on your Windows build version %winbuild%.
|
||||||
goto :oe_goback
|
goto :oe_goback
|
||||||
)
|
)
|
||||||
|
if defined ltscfound (
|
||||||
|
%eline%
|
||||||
|
echo Installed Office update channel: %ltsc19%%ltsc21%%ltsc24%
|
||||||
|
echo Unsupported Office update channel is installed on your Windows build version %winbuild%.
|
||||||
|
goto :oe_goback
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
::===============
|
::===============
|
||||||
@ -988,49 +1043,52 @@ set inpt=
|
|||||||
set counter=0
|
set counter=0
|
||||||
set verified=0
|
set verified=0
|
||||||
set targetFFN=
|
set targetFFN=
|
||||||
|
set bypassFFN=
|
||||||
set targetchannel=
|
set targetchannel=
|
||||||
|
|
||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%"
|
call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%"
|
||||||
call :dk_color %Gray% "Unsupported update channels are excluded from this list."
|
call :dk_color %Gray% "Installed Office editions: %_oIds%"
|
||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
|
|
||||||
for %%# in (
|
for %%# in (
|
||||||
"5440FD1F-7ECB-4221-8110-145EFAA6372F_Insider Fast [Beta] - Insiders::DevMain"
|
"5440fd1f-7ecb-4221-8110-145efaa6372f_Insider Fast [Beta] - Insiders::DevMain -"
|
||||||
"64256AFE-F5D9-4F86-8936-8840A6A4F5BE_Monthly Preview - Insiders::CC"
|
"64256afe-f5d9-4f86-8936-8840a6a4f5be_Monthly Preview - Insiders::CC -"
|
||||||
"492350F6-3A01-4F97-B9C0-C7C6DDF67D60_Monthly [Current] - Production::CC"
|
"492350f6-3a01-4f97-b9c0-c7c6ddf67d60_Monthly [Current] - Production::CC -"
|
||||||
"55336B82-A18D-4DD6-B5F6-9E5095C314A6_Monthly Enterprise - Production::MEC"
|
"55336b82-a18d-4dd6-b5f6-9e5095c314a6_Monthly Enterprise - Production::MEC -"
|
||||||
"B8F9B850-328D-4355-9145-C59439A0C4CF_Semi Annual Preview - Insiders::FRDC"
|
"b8f9b850-328d-4355-9145-c59439a0c4cf_Semi Annual Preview - Insiders::FRDC -"
|
||||||
"7FFBC6BF-BC32-4F92-8982-F9DD17FD3114_Semi Annual - Production::DC"
|
"7ffbc6bf-bc32-4f92-8982-f9dd17fd3114_Semi Annual - Production::DC -"
|
||||||
"EA4A4090-DE26-49D7-93C1-91BFF9E53FC3_DevMain Channel - Dogfood::DevMain"
|
"ea4a4090-de26-49d7-93c1-91bff9e53fc3_DevMain Channel - Dogfood::DevMain -"
|
||||||
"B61285DD-D9F7-41F2-9757-8F61CBA4E9C8_Microsoft Elite - Microsoft::DevMain"
|
"b61285dd-d9f7-41f2-9757-8f61cba4e9c8_Microsoft Elite - Microsoft::DevMain -"
|
||||||
"F2E724C1-748F-4B47-8FB8-8E0D210E9208_Perpetual2019 VL - Production::LTSC"
|
"f2e724c1-748f-4b47-8fb8-8e0d210e9208_Perpetual2019 VL - Production::LTSC -"
|
||||||
"1D2D2EA6-1680-4C56-AC58-A441C8C24FF9_Microsoft2019 VL - Microsoft::LTSC"
|
"1d2d2ea6-1680-4c56-ac58-a441c8c24ff9_Microsoft2019 VL - Microsoft::LTSC -"
|
||||||
"5030841D-C919-4594-8D2D-84AE4F96E58E_Perpetual2021 VL - Production::LTSC2021"
|
"5030841d-c919-4594-8d2d-84ae4f96e58e_Perpetual2021 VL - Production::LTSC2021 -"
|
||||||
"86752282-5841-4120-AC80-DB03AE6B5FDB_Microsoft2021 VL - Microsoft::LTSC2021"
|
"86752282-5841-4120-ac80-db03ae6b5fdb_Microsoft2021 VL - Microsoft::LTSC2021 -"
|
||||||
"7983BAC0-E531-40CF-BE00-FD24FE66619C_Perpetual2024 VL - Production::LTSC2024"
|
"7983bac0-e531-40cf-be00-fd24fe66619c_Perpetual2024 VL - Production::LTSC2024 -"
|
||||||
"C02D8FE6-5242-4DA8-972F-82EE55E00671_Microsoft2024 VL - Microsoft::LTSC2024"
|
"c02d8fe6-5242-4da8-972f-82ee55e00671_Microsoft2024 VL - Microsoft::LTSC2024 -"
|
||||||
) do (
|
) do (
|
||||||
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
|
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
|
||||||
|
set bypass=
|
||||||
set supported=
|
set supported=
|
||||||
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
|
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
|
||||||
if %winbuild% GEQ 10240 (
|
if %winbuild% GEQ 10240 (
|
||||||
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported=
|
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set bypass=1
|
||||||
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported=
|
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set bypass=1
|
||||||
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported=
|
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set bypass=1
|
||||||
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported=
|
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set bypass=1
|
||||||
)
|
)
|
||||||
if defined supported (
|
if defined supported (
|
||||||
set /a counter+=1
|
set /a counter+=1
|
||||||
if !counter! LSS 10 (
|
if !counter! LSS 10 (
|
||||||
echo [!counter!] %%B
|
if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
|
||||||
) else (
|
) else (
|
||||||
echo [!counter!] %%B
|
if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
|
||||||
)
|
)
|
||||||
set targetFFN!counter!=%%A
|
set targetFFN!counter!=%%A
|
||||||
set targetchannel!counter!=%%B
|
set targetchannel!counter!=%%B
|
||||||
|
if defined bypass set bypassFFN=!bypassFFN!%%A
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1044,7 +1102,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En
|
|||||||
set /p inpt=
|
set /p inpt=
|
||||||
if "%inpt%"=="" goto :oe_changeupdchnl
|
if "%inpt%"=="" goto :oe_changeupdchnl
|
||||||
if "%inpt%"=="0" goto :oemenu
|
if "%inpt%"=="0" goto :oemenu
|
||||||
if /i "%inpt%"=="R" start https://learn.microsoft.com/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl
|
if /i "%inpt%"=="R" start https://learn.microsoft.com/en-us/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl
|
||||||
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
|
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
|
||||||
set targetFFN=!targetFFN%inpt%!
|
set targetFFN=!targetFFN%inpt%!
|
||||||
set targetchannel=!targetchannel%inpt%!
|
set targetchannel=!targetchannel%inpt%!
|
||||||
@ -1058,18 +1116,148 @@ if not defined terminal mode 105, 32
|
|||||||
:: Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results
|
:: Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results
|
||||||
|
|
||||||
set build=
|
set build=
|
||||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a)
|
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a)
|
||||||
echo "%build%" | find /i "16." %nul% || set build=
|
echo "%build%" | find /i "16." %nul% || set build=
|
||||||
|
|
||||||
|
echo:
|
||||||
|
for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A)
|
||||||
|
echo Target build number: %build%
|
||||||
|
echo: %bypassFFN% | find /i "%targetFFN%" %nul% && goto :oe_changeunoff
|
||||||
|
|
||||||
|
call :oe_cleanupreg
|
||||||
|
|
||||||
|
if not defined build (
|
||||||
|
if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN."
|
||||||
|
set "updcommand="%_c2rCexe%" /update user"
|
||||||
|
) else (
|
||||||
|
set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%"
|
||||||
|
)
|
||||||
|
echo Running the below command to trigger updates...
|
||||||
|
echo:
|
||||||
|
echo %updcommand%
|
||||||
|
%updcommand%
|
||||||
|
echo:
|
||||||
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
|
goto :oe_goback
|
||||||
|
|
||||||
|
::=======================
|
||||||
|
|
||||||
|
:: Unofficial method to change channel
|
||||||
|
|
||||||
|
:oe_changeunoff
|
||||||
|
|
||||||
|
set abortchange=
|
||||||
|
echo %targetchannel% | find /i "2019 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2019Volume" %nul% || set abortchange=1))
|
||||||
|
echo %targetchannel% | find /i "2021 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2021Volume" %nul% || set abortchange=1))
|
||||||
|
echo %targetchannel% | find /i "2024 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2024Volume" %nul% || set abortchange=1))
|
||||||
|
|
||||||
|
if defined abortchange (
|
||||||
|
%eline%
|
||||||
|
echo Mismatch found in installed Office products and target update channel. Aborting...
|
||||||
|
echo Non-perpetual Office products are not suppported with Perpetual VL update channels.
|
||||||
|
goto :oe_goback
|
||||||
|
)
|
||||||
|
|
||||||
|
if not defined build (
|
||||||
|
%eline%
|
||||||
|
call :dk_color %Red% "Failed to detect build number for the target FFN."
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto :oe_goback
|
||||||
|
)
|
||||||
|
|
||||||
|
set buildchk=0
|
||||||
|
for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a"
|
||||||
|
|
||||||
|
call :oe_getlangs %_firstoId%
|
||||||
|
|
||||||
|
echo %targetchannel% | find /i "2019 VL" %nul% && (
|
||||||
|
for %%A in (en-gb es-mx fr-ca) do (
|
||||||
|
echo %_allLangs% | find /i "%%A" %nul% && (
|
||||||
|
%eline%
|
||||||
|
echo [%%A] language is not supported on the Office 2019 Perpetual VL update channel. Aborting...
|
||||||
|
goto :oe_goback
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
|
||||||
|
set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE"
|
||||||
|
|
||||||
|
if %clverchk% LSS %buildchk% (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Blue% "Do not terminate the operation before it completes..."
|
||||||
|
echo:
|
||||||
|
echo Updating Office C2R client with the command below, please wait...
|
||||||
|
echo:
|
||||||
|
echo %c2rclientupdate%
|
||||||
|
%c2rclientupdate%
|
||||||
|
for /l %%i in (1,1,30) do (if !clverchk! LSS %buildchk% (call :ch_getinfo&timeout /t 10 %nul%))
|
||||||
|
)
|
||||||
|
|
||||||
|
if %clverchk% LSS %buildchk% (
|
||||||
|
echo:
|
||||||
|
call :dk_color %Red% "Failed to update Office C2R client. Aborting..."
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto :oe_goback
|
||||||
|
)
|
||||||
|
|
||||||
|
call :oe_cleanupreg
|
||||||
|
|
||||||
|
echo Running the below command to change update channel, please wait...
|
||||||
|
echo:
|
||||||
|
echo %c2rcommand%
|
||||||
|
%c2rcommand%
|
||||||
|
set errorcode=%errorlevel%
|
||||||
|
timeout /t 10 %nul%
|
||||||
|
|
||||||
|
echo:
|
||||||
|
if %errorcode% EQU 0 (
|
||||||
|
call :dk_color %Gray% "Now run the Office activation option from the main menu."
|
||||||
|
) else (
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:oe_goback
|
||||||
|
|
||||||
|
call :oe_tempcleanup
|
||||||
|
|
||||||
|
echo:
|
||||||
|
if defined fixes (
|
||||||
|
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||||
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
|
choice /C:10 /N
|
||||||
|
if !errorlevel!==2 goto :oemenu
|
||||||
|
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined terminal (
|
||||||
|
call :dk_color %_Yellow% "Press [0] key to go back..."
|
||||||
|
choice /c 0 /n
|
||||||
|
) else (
|
||||||
|
call :dk_color %_Yellow% "Press any key to go back..."
|
||||||
|
pause %nul1%
|
||||||
|
)
|
||||||
|
goto :oemenu
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:oe_cleanupreg
|
||||||
|
|
||||||
:: Cleanup Office update related registries, thanks to @abbodi1406
|
:: Cleanup Office update related registries, thanks to @abbodi1406
|
||||||
:: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813
|
:: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813
|
||||||
:: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels
|
:: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels
|
||||||
|
|
||||||
echo:
|
|
||||||
for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A)
|
|
||||||
echo:
|
echo:
|
||||||
echo Cleaning Office update registry keys...
|
echo Cleaning Office update registry keys...
|
||||||
echo Adding new update channel to registry keys...
|
echo Adding new update channel to registry keys...
|
||||||
|
echo:
|
||||||
|
|
||||||
%nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
|
%nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
|
||||||
%nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
|
%nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
|
||||||
@ -1086,43 +1274,7 @@ echo Adding new update channel to registry keys...
|
|||||||
%nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32
|
%nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32
|
||||||
%nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f
|
%nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f
|
||||||
|
|
||||||
if not defined build (
|
exit /b
|
||||||
if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN."
|
|
||||||
set "updcommand="%_c2rCexe%" /update user"
|
|
||||||
) else (
|
|
||||||
set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%"
|
|
||||||
)
|
|
||||||
echo Running the below command to trigger updates...
|
|
||||||
echo:
|
|
||||||
echo %updcommand%
|
|
||||||
%updcommand%
|
|
||||||
echo:
|
|
||||||
echo Check this webpage for help - %mas%troubleshoot
|
|
||||||
goto :oe_goback
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:oe_goback
|
|
||||||
|
|
||||||
call :oe_tempcleanup
|
|
||||||
|
|
||||||
echo:
|
|
||||||
if defined fixes (
|
|
||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
|
||||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
|
||||||
choice /C:10 /N
|
|
||||||
if !errorlevel!==2 goto :oemenu
|
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined terminal (
|
|
||||||
call :dk_color %_Yellow% "Press [0] key to go back..."
|
|
||||||
choice /c 0 /n
|
|
||||||
) else (
|
|
||||||
call :dk_color %_Yellow% "Press any key to go back..."
|
|
||||||
pause %nul1%
|
|
||||||
)
|
|
||||||
goto :oemenu
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@ -1145,6 +1297,7 @@ set _oRoot=
|
|||||||
set _oArch=
|
set _oArch=
|
||||||
set _updch=
|
set _updch=
|
||||||
set _oIds=
|
set _oIds=
|
||||||
|
set _firstoId=
|
||||||
set _lang=
|
set _lang=
|
||||||
set _cfolder=
|
set _cfolder=
|
||||||
set _version=
|
set _version=
|
||||||
@ -1175,9 +1328,13 @@ for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseI
|
|||||||
if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a")
|
if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a")
|
||||||
)
|
)
|
||||||
set _oIds=%_oIds:.16=%
|
set _oIds=%_oIds:.16=%
|
||||||
|
for /f "tokens=1" %%A in ("%_oIds%") do set _firstoId=%%A
|
||||||
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\Configuration /v %_firstoId%.ExcludedApps" %nul6%') do (set "_firstoIdExcludelist=%%b")
|
||||||
|
|
||||||
set verchk=0
|
set verchk=0
|
||||||
|
set clverchk=0
|
||||||
for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a"
|
for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a"
|
||||||
|
for /f "tokens=3 delims=." %%a in ("%_clversion%") do set "clverchk=%%a"
|
||||||
|
|
||||||
if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml"
|
if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml"
|
||||||
|
|
||||||
@ -1193,16 +1350,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
|
|||||||
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
|
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
|
||||||
)
|
)
|
||||||
|
|
||||||
set "audidata4=%_AudienceData:~-4%"
|
:: Check LTSC version files
|
||||||
|
|
||||||
if /i "%audidata4%"=="LTSC" set ltsc19=LTSC
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\ProductReleaseIDs\%_actconfig%" /s %nul6%') do (
|
||||||
echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
|
echo "%%b" %nul2% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
|
||||||
|
echo "%%b" %nul2% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
|
||||||
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021
|
echo "%%b" %nul2% | findstr "16.0.17932" %nul% && set ltsc24=LTSC2024
|
||||||
echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
|
)
|
||||||
|
|
||||||
if /i "%audidata4%"=="2024" set ltsc24=LTSC2024
|
|
||||||
:: LTSC 2024 build is not fixed yet
|
|
||||||
|
|
||||||
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
|
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
|
||||||
|
|
||||||
@ -1210,6 +1364,27 @@ exit /b
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check all the installed languages
|
||||||
|
|
||||||
|
:oe_getlangs
|
||||||
|
|
||||||
|
if "%1"=="" (
|
||||||
|
set langreg=culture
|
||||||
|
) else (
|
||||||
|
set langreg=%1.16
|
||||||
|
)
|
||||||
|
|
||||||
|
set _allLangs=
|
||||||
|
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9)
|
||||||
|
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%langreg%" /f "-" /k ^| findstr /i "%langreg%\\.*-.*"') do (
|
||||||
|
if defined _allLangs (set "_allLangs=!_allLangs!_%%a") else (set "_allLangs=%%a")
|
||||||
|
)
|
||||||
|
|
||||||
|
set _allLangs=%_allLangs:.16=%
|
||||||
|
exit /b
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check Internet connection
|
:: Check Internet connection
|
||||||
|
|
||||||
:oe_chkinternet
|
:oe_chkinternet
|
||||||
@ -1477,7 +1652,7 @@ call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
|||||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 exit /b
|
if !errorlevel!==2 exit /b
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
@set masver=3.2
|
@set masver=3.4
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::============================================================================
|
::============================================================================
|
||||||
::
|
::
|
||||||
:: Homepage: mass grave[.]dev
|
:: Homepage: mass<>grave<.>dev
|
||||||
:: Email: mas.help@outlook.com
|
:: Email: mas.help@outlook.com
|
||||||
::
|
::
|
||||||
::============================================================================
|
::============================================================================
|
||||||
@ -65,6 +65,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||||
|
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||||
|
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||||
|
|
||||||
:: Check if Null service is working, it's important for the batch script
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -138,6 +140,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not exist "%SysPath%\logoff.exe" (
|
||||||
|
sc query gcs | find /i "RUNNING" %nul% && (
|
||||||
|
%eline%
|
||||||
|
echo Windows Sandbox detected.
|
||||||
|
echo The script cannot run due to missing licensing components. Aborting...
|
||||||
|
echo:
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 7600 (
|
||||||
%eline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
@ -193,16 +205,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
REM check LanguageMode
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -232,7 +246,17 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
echo:
|
||||||
|
sc query sense | find /i "RUNNING" %nul% && (
|
||||||
|
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||||
|
)
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -253,7 +277,9 @@ set terminal=
|
|||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set lines=0
|
set lines=0
|
||||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||||
|
for %%B in (%%A) do set lines=%%B
|
||||||
|
)
|
||||||
if !lines! GEQ 100 set terminal=
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -314,7 +340,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -390,8 +416,7 @@ if not defined allapps (
|
|||||||
%eline%
|
%eline%
|
||||||
echo Failed to find activation IDs. Aborting...
|
echo Failed to find activation IDs. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -413,8 +438,7 @@ if not defined osedition (
|
|||||||
%eline%
|
%eline%
|
||||||
echo Failed to detect OS edition, aborting...
|
echo Failed to detect OS edition, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -437,7 +461,7 @@ set _ntarget=
|
|||||||
set _wtarget=
|
set _wtarget=
|
||||||
|
|
||||||
if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a "))
|
if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a "))
|
||||||
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
||||||
|
|
||||||
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||||
if %winbuild% GEQ 17063 call :ced_edilist
|
if %winbuild% GEQ 17063 call :ced_edilist
|
||||||
@ -643,7 +667,7 @@ echo:
|
|||||||
call :ced_prep
|
call :ced_prep
|
||||||
if defined preperror goto dk_done
|
if defined preperror goto dk_done
|
||||||
|
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%"
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%"
|
||||||
call :ced_postprep
|
call :ced_postprep
|
||||||
)
|
)
|
||||||
%line%
|
%line%
|
||||||
@ -681,7 +705,7 @@ call :ced_prep
|
|||||||
if defined preperror goto dk_done
|
if defined preperror goto dk_done
|
||||||
|
|
||||||
if %_stg%==0 (set stage=) else (set stage=-StageCurrent)
|
if %_stg%==0 (set stage=) else (set stage=-StageCurrent)
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%"
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%"
|
||||||
call :ced_postprep
|
call :ced_postprep
|
||||||
%line%
|
%line%
|
||||||
|
|
||||||
@ -795,7 +819,7 @@ exit /b
|
|||||||
|
|
||||||
:: https://stackoverflow.com/a/46268232
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
set "ddf="%SystemRoot%\Temp\ddf""
|
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
||||||
%nul% del /q /f %ddf%
|
%nul% del /q /f %ddf%
|
||||||
echo/.New Cabinet>%ddf%
|
echo/.New Cabinet>%ddf%
|
||||||
echo/.set Cabinet=ON>>%ddf%
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
@ -1058,7 +1082,7 @@ call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
|||||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 exit /b
|
if !errorlevel!==2 exit /b
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
@ -1347,55 +1371,55 @@ if %winbuild% GEQ 22000 exit /b
|
|||||||
)
|
)
|
||||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=)
|
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=)
|
||||||
|
|
||||||
set h=
|
set w=
|
||||||
for %%# in (
|
for %%# in (
|
||||||
XGVPP-NMH47-7TTHJ-W3FW7-8HV%h%2C__OEM:NONSLP_Enterprise
|
XGVPP-NMH47-7TTHJ-W3FW7-8HV%w%2C__OEM:NONSLP_Enterprise
|
||||||
D6RD9-D4N8T-RT9QX-YW6YT-FCW%h%WJ______Retail_Starter
|
D6RD9-D4N8T-RT9QX-YW6YT-FCW%w%WJ______Retail_Starter
|
||||||
3V6Q6-NQXCX-V8YXR-9QCYV-QPF%h%CT__Volume:MAK_EnterpriseN
|
3V6Q6-NQXCX-V8YXR-9QCYV-QPF%w%CT__Volume:MAK_EnterpriseN
|
||||||
3NFXW-2T27M-2BDW6-4GHRV-68X%h%RX______Retail_StarterN
|
3NFXW-2T27M-2BDW6-4GHRV-68X%w%RX______Retail_StarterN
|
||||||
VK7JG-NPHTM-C97JM-9MPGT-3V6%h%6T______Retail_Professional
|
VK7JG-NPHTM-C97JM-9MPGT-3V6%w%6T______Retail_Professional
|
||||||
2B87N-8KFHP-DKV6R-Y2C8J-PKC%h%KT______Retail_ProfessionalN
|
2B87N-8KFHP-DKV6R-Y2C8J-PKC%w%KT______Retail_ProfessionalN
|
||||||
4CPRK-NM3K3-X6XXQ-RXX86-WXC%h%HW______Retail_CoreN
|
4CPRK-NM3K3-X6XXQ-RXX86-WXC%w%HW______Retail_CoreN
|
||||||
N2434-X9D7W-8PF6X-8DV9T-8TY%h%MD______Retail_CoreCountrySpecific
|
N2434-X9D7W-8PF6X-8DV9T-8TY%w%MD______Retail_CoreCountrySpecific
|
||||||
BT79Q-G7N6G-PGBYW-4YWX6-6F4%h%BT______Retail_CoreSingleLanguage
|
BT79Q-G7N6G-PGBYW-4YWX6-6F4%w%BT______Retail_CoreSingleLanguage
|
||||||
YTMG3-N6DKC-DKB77-7M9GH-8HV%h%X7______Retail_Core
|
YTMG3-N6DKC-DKB77-7M9GH-8HV%w%X7______Retail_Core
|
||||||
XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro
|
XKCNC-J26Q9-KFHD2-FKTHY-KD7%w%2Y__OEM:NONSLP_PPIPro
|
||||||
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education
|
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%w%BY______Retail_Education
|
||||||
84NGF-MHBT6-FXBX8-QWJK7-DRR%h%8H______Retail_EducationN
|
84NGF-MHBT6-FXBX8-QWJK7-DRR%w%8H______Retail_EducationN
|
||||||
KCNVH-YKWX8-GJJB9-H9FDT-6F7%h%W2__Volume:MAK_EnterpriseS_VB
|
KCNVH-YKWX8-GJJB9-H9FDT-6F7%w%W2__Volume:MAK_EnterpriseS_VB
|
||||||
43TBQ-NH92J-XKTM7-KT3KK-P39%h%PB__OEM:NONSLP_EnterpriseS_RS5
|
43TBQ-NH92J-XKTM7-KT3KK-P39%w%PB__OEM:NONSLP_EnterpriseS_RS5
|
||||||
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1
|
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%w%WX__OEM:NONSLP_EnterpriseS_RS1
|
||||||
FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH
|
FWN7H-PF93Q-4GGP8-M8RF3-MDW%w%WW__OEM:NONSLP_EnterpriseS_TH
|
||||||
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%h%PT__Volume:MAK_EnterpriseSN_VB
|
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%w%PT__Volume:MAK_EnterpriseSN_VB
|
||||||
M33WV-NHY3C-R7FPM-BQGPT-239%h%PG__Volume:MAK_EnterpriseSN_RS5
|
M33WV-NHY3C-R7FPM-BQGPT-239%w%PG__Volume:MAK_EnterpriseSN_RS5
|
||||||
2DBW3-N2PJG-MVHW3-G7TDK-9HK%h%R4__Volume:MAK_EnterpriseSN_RS1
|
2DBW3-N2PJG-MVHW3-G7TDK-9HK%w%R4__Volume:MAK_EnterpriseSN_RS1
|
||||||
NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH
|
NTX6B-BRYC2-K6786-F6MVQ-M7V%w%2X__Volume:MAK_EnterpriseSN_TH
|
||||||
G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage
|
G3KNM-CHG6T-R36X3-9QDG6-8M8%w%K9______Retail_ProfessionalSingleLanguage
|
||||||
HNGCC-Y38KG-QVK8D-WMWRK-X86%h%VK______Retail_ProfessionalCountrySpecific
|
HNGCC-Y38KG-QVK8D-WMWRK-X86%w%VK______Retail_ProfessionalCountrySpecific
|
||||||
DXG7C-N36C4-C4HTG-X4T3X-2YV%h%77______Retail_ProfessionalWorkstation
|
DXG7C-N36C4-C4HTG-X4T3X-2YV%w%77______Retail_ProfessionalWorkstation
|
||||||
WYPNQ-8C467-V2W6J-TX4WX-WT2%h%RQ______Retail_ProfessionalWorkstationN
|
WYPNQ-8C467-V2W6J-TX4WX-WT2%w%RQ______Retail_ProfessionalWorkstationN
|
||||||
8PTT6-RNW4C-6V7J2-C2D3X-MHB%h%PB______Retail_ProfessionalEducation
|
8PTT6-RNW4C-6V7J2-C2D3X-MHB%w%PB______Retail_ProfessionalEducation
|
||||||
GJTYN-HDMQY-FRR76-HVGC7-QPF%h%8P______Retail_ProfessionalEducationN
|
GJTYN-HDMQY-FRR76-HVGC7-QPF%w%8P______Retail_ProfessionalEducationN
|
||||||
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG
|
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%w%JC__Volume:MAK_EnterpriseG
|
||||||
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN
|
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%w%Y8__Volume:MAK_EnterpriseGN
|
||||||
NJCF7-PW8QT-3324D-688JX-2YV%h%66______Retail_ServerRdsh
|
NJCF7-PW8QT-3324D-688JX-2YV%w%66______Retail_ServerRdsh
|
||||||
XQQYW-NFFMW-XJPBH-K8732-CKF%h%FD______OEM:DM_IoTEnterprise
|
XQQYW-NFFMW-XJPBH-K8732-CKF%w%FD______OEM:DM_IoTEnterprise
|
||||||
QPM6N-7J2WJ-P88HH-P3YRH-YY7%h%4H__OEM:NONSLP_IoTEnterpriseS
|
QPM6N-7J2WJ-P88HH-P3YRH-YY7%w%4H__OEM:NONSLP_IoTEnterpriseS
|
||||||
K9VKN-3BGWV-Y624W-MCRMQ-BHD%h%CD______Retail_CloudEditionN
|
K9VKN-3BGWV-Y624W-MCRMQ-BHD%w%CD______Retail_CloudEditionN
|
||||||
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%h%4W______Retail_CloudEdition
|
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%w%4W______Retail_CloudEdition
|
||||||
V3WVW-N2PV2-CGWC3-34QGF-VMJ%h%2C______Retail_Cloud
|
V3WVW-N2PV2-CGWC3-34QGF-VMJ%w%2C______Retail_Cloud
|
||||||
NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN
|
NH9J3-68WK7-6FB93-4K3DF-DJ4%w%F6______Retail_CloudN
|
||||||
2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE
|
2HN6V-HGTM8-6C97C-RK67V-JQP%w%FD______Retail_CloudE
|
||||||
WC2BQ-8NRM3-FDDYY-2BFGV-KHK%h%QY_Volume:GVLK_ServerStandard%Cor%_RS1
|
WC2BQ-8NRM3-FDDYY-2BFGV-KHK%w%QY_Volume:GVLK_ServerStandard%Cor%_RS1
|
||||||
CB7KF-BWN84-R7R2Y-793K2-8XD%h%DG_Volume:GVLK_ServerDatacenter%Cor%_RS1
|
CB7KF-BWN84-R7R2Y-793K2-8XD%w%DG_Volume:GVLK_ServerDatacenter%Cor%_RS1
|
||||||
JCKRF-N37P4-C2D82-9YXRT-4M6%h%3B_Volume:GVLK_ServerSolution_RS1
|
JCKRF-N37P4-C2D82-9YXRT-4M6%w%3B_Volume:GVLK_ServerSolution_RS1
|
||||||
QN4C6-GBJD2-FB422-GHWJK-GJG%h%2R_Volume:GVLK_ServerCloudStorage_RS1
|
QN4C6-GBJD2-FB422-GHWJK-GJG%w%2R_Volume:GVLK_ServerCloudStorage_RS1
|
||||||
VP34G-4NPPG-79JTQ-864T4-R3M%h%QX_Volume:GVLK_ServerAzureCor_RS1
|
VP34G-4NPPG-79JTQ-864T4-R3M%w%QX_Volume:GVLK_ServerAzureCor_RS1
|
||||||
9JQNQ-V8HQ6-PKB8H-GGHRY-R62%h%H6______Retail_ServerAzureNano_RS1
|
9JQNQ-V8HQ6-PKB8H-GGHRY-R62%w%H6______Retail_ServerAzureNano_RS1
|
||||||
VN8D3-PR82H-DB6BJ-J9P4M-92F%h%6J______Retail_ServerStorageStandard_RS1
|
VN8D3-PR82H-DB6BJ-J9P4M-92F%w%6J______Retail_ServerStorageStandard_RS1
|
||||||
48TQX-NVK3R-D8QR3-GTHHM-8FH%h%XC______Retail_ServerStorageWorkgroup_RS1
|
48TQX-NVK3R-D8QR3-GTHHM-8FH%w%XC______Retail_ServerStorageWorkgroup_RS1
|
||||||
2HXDN-KRXHB-GPYC7-YCKFJ-7FV%h%DG_Volume:GVLK_ServerDatacenterACor_RS3
|
2HXDN-KRXHB-GPYC7-YCKFJ-7FV%w%DG_Volume:GVLK_ServerDatacenterACor_RS3
|
||||||
PTXN8-JFHJM-4WC78-MPCBR-9W4%h%KR_Volume:GVLK_ServerStandardACor_RS3
|
PTXN8-JFHJM-4WC78-MPCBR-9W4%w%KR_Volume:GVLK_ServerStandardACor_RS3
|
||||||
) do (
|
) do (
|
||||||
for /f "tokens=1-4 delims=_" %%A in ("%%#") do if /i %targetedition%==%%C (
|
for /f "tokens=1-4 delims=_" %%A in ("%%#") do if /i %targetedition%==%%C (
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ goto :E_Exit
|
|||||||
set "_batf=%~f0"
|
set "_batf=%~f0"
|
||||||
set "_batp=%_batf:'=''%"
|
set "_batp=%_batf:'=''%"
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
%_psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';iex ($f[1])"
|
%_psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
|
|
||||||
:E_Exit
|
:E_Exit
|
||||||
echo.
|
echo.
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
@set masver=3.2
|
@set masver=3.4
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::============================================================================
|
::============================================================================
|
||||||
::
|
::
|
||||||
:: Homepage: mass grave[.]dev
|
:: Homepage: mass<>grave<.>dev
|
||||||
:: Email: mas.help@outlook.com
|
:: Email: mas.help@outlook.com
|
||||||
::
|
::
|
||||||
::============================================================================
|
::============================================================================
|
||||||
@ -60,6 +60,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||||
|
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||||
|
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||||
|
|
||||||
:: Check if Null service is working, it's important for the batch script
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -132,6 +134,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto done2
|
goto done2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not exist "%SysPath%\logoff.exe" (
|
||||||
|
sc query gcs | find /i "RUNNING" %nul% && (
|
||||||
|
%eline%
|
||||||
|
echo Windows Sandbox detected.
|
||||||
|
echo The script cannot run due to missing licensing components. Aborting...
|
||||||
|
echo:
|
||||||
|
goto done2
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 6001 (
|
if %winbuild% LSS 6001 (
|
||||||
%nceline%
|
%nceline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
@ -204,16 +216,18 @@ goto done2
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
REM check LanguageMode
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -243,7 +257,17 @@ goto done2
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
echo:
|
||||||
|
sc query sense | find /i "RUNNING" %nul% && (
|
||||||
|
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||||
|
)
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -264,7 +288,9 @@ set terminal=
|
|||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set lines=0
|
set lines=0
|
||||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||||
|
for %%B in (%%A) do set lines=%%B
|
||||||
|
)
|
||||||
if !lines! GEQ 100 set terminal=
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -325,7 +351,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -732,7 +758,7 @@ call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
|||||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 exit /b
|
if !errorlevel!==2 exit /b
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
@ -806,7 +832,7 @@ exit /b
|
|||||||
|
|
||||||
:export
|
:export
|
||||||
|
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
@set masver=3.2
|
@set masver=3.4
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::============================================================================
|
::============================================================================
|
||||||
::
|
::
|
||||||
:: Homepage: mass grave[.]dev
|
:: Homepage: mass<>grave<.>dev
|
||||||
:: Email: mas.help@outlook.com
|
:: Email: mas.help@outlook.com
|
||||||
::
|
::
|
||||||
::============================================================================
|
::============================================================================
|
||||||
@ -60,6 +60,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||||
|
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||||
|
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||||
|
|
||||||
:: Check if Null service is working, it's important for the batch script
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -133,6 +135,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not exist "%SysPath%\logoff.exe" (
|
||||||
|
sc query gcs | find /i "RUNNING" %nul% && (
|
||||||
|
%eline%
|
||||||
|
echo Windows Sandbox detected.
|
||||||
|
echo The script cannot run due to missing licensing components. Aborting...
|
||||||
|
echo:
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 6001 (
|
if %winbuild% LSS 6001 (
|
||||||
%nceline%
|
%nceline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
@ -205,16 +217,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
REM check LanguageMode
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -244,7 +258,17 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
echo:
|
||||||
|
sc query sense | find /i "RUNNING" %nul% && (
|
||||||
|
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||||
|
)
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -265,7 +289,9 @@ set terminal=
|
|||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set lines=0
|
set lines=0
|
||||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||||
|
for %%B in (%%A) do set lines=%%B
|
||||||
|
)
|
||||||
if !lines! GEQ 100 set terminal=
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -326,7 +352,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -387,7 +413,7 @@ if %_erl%==5 goto:retokens
|
|||||||
if %_erl%==4 goto:fixwmi
|
if %_erl%==4 goto:fixwmi
|
||||||
if %_erl%==3 goto:sfcscan
|
if %_erl%==3 goto:sfcscan
|
||||||
if %_erl%==2 goto:dism_rest
|
if %_erl%==2 goto:dism_rest
|
||||||
if %_erl%==1 start %mas%troubleshoot.html &goto at_menu
|
if %_erl%==1 (start %selfgit% & start %github% & start %mas%troubleshoot & goto at_menu)
|
||||||
goto :at_menu
|
goto :at_menu
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@ -681,6 +707,25 @@ echo:
|
|||||||
call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
|
call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
|
||||||
echo:
|
echo:
|
||||||
|
|
||||||
|
echo Clearing KMS Cache...
|
||||||
|
echo:
|
||||||
|
call :_taskclear-cache
|
||||||
|
|
||||||
|
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
|
||||||
|
echo Removing KMS38 protection...
|
||||||
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
|
||||||
|
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
|
||||||
|
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
|
||||||
|
call :dk_color %Red% "Failed to remove KMS38 protection."
|
||||||
|
) || (
|
||||||
|
echo Successfully removed KMS38 protection.
|
||||||
|
echo Successfully cleared KMS Cache.
|
||||||
|
)
|
||||||
|
) || (
|
||||||
|
echo Successfully cleared KMS Cache.
|
||||||
|
)
|
||||||
|
echo:
|
||||||
|
|
||||||
call :scandat check
|
call :scandat check
|
||||||
|
|
||||||
if not defined token (
|
if not defined token (
|
||||||
@ -706,7 +751,7 @@ echo Checking SPP permission related issues...
|
|||||||
call :checkperms
|
call :checkperms
|
||||||
if defined permerror (
|
if defined permerror (
|
||||||
call :dk_color %Red% "[!permerror!]"
|
call :dk_color %Red% "[!permerror!]"
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';iex ($f[1])" %nul%
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';. ([scriptblock]::Create($f[1]))" %nul%
|
||||||
call :checkperms
|
call :checkperms
|
||||||
if defined permerror (
|
if defined permerror (
|
||||||
call :dk_color %Red% "[!permerror!] [Failed To Fix]"
|
call :dk_color %Red% "[!permerror!] [Failed To Fix]"
|
||||||
@ -733,7 +778,7 @@ for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsof
|
|||||||
|
|
||||||
if %winbuild% LSS 9200 if not defined _vis (
|
if %winbuild% LSS 9200 if not defined _vis (
|
||||||
REM Fix issues caused by Update KB971033 in Windows 7
|
REM Fix issues caused by Update KB971033 in Windows 7
|
||||||
REM https://support.microsoft.com/help/4487266
|
REM https://support.microsoft.com/en-us/help/4487266
|
||||||
echo:
|
echo:
|
||||||
echo Checking Update KB971033...
|
echo Checking Update KB971033...
|
||||||
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
|
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
|
||||||
@ -776,8 +821,8 @@ if defined _vis (
|
|||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Reinstalling system licenses...
|
echo Reinstalling system licenses...
|
||||||
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||||
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||||
if %errorlevel% EQU 0 (
|
if %errorlevel% EQU 0 (
|
||||||
echo [Successful]
|
echo [Successful]
|
||||||
) else (
|
) else (
|
||||||
@ -1178,7 +1223,7 @@ goto :at_menu
|
|||||||
|
|
||||||
:: https://stackoverflow.com/a/46268232
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
set "ddf="%SystemRoot%\Temp\ddf""
|
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
||||||
%nul% del /q /f %ddf%
|
%nul% del /q /f %ddf%
|
||||||
echo/.New Cabinet>%ddf%
|
echo/.New Cabinet>%ddf%
|
||||||
echo/.set Cabinet=ON>>%ddf%
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
@ -1230,7 +1275,7 @@ set "permerror=Error Found In SPP Registries"
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
if not defined permerror (
|
if not defined permerror (
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
@ -1244,6 +1289,59 @@ exit /b
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Clean existing K-M-S cache from the registry
|
||||||
|
|
||||||
|
:_taskclear-cache
|
||||||
|
|
||||||
|
set w=
|
||||||
|
for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do (
|
||||||
|
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%
|
||||||
|
)
|
||||||
|
|
||||||
|
set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"
|
||||||
|
|
||||||
|
if %winbuild% LSS 7600 (
|
||||||
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && (
|
||||||
|
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if not defined SPPk (
|
||||||
|
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
|
||||||
|
)
|
||||||
|
|
||||||
|
set "slp=SoftwareLicensingProduct"
|
||||||
|
set "ospp=OfficeSoftwareProtectionProduct"
|
||||||
|
|
||||||
|
set "_wApp=55c92734-d682-4d71-983e-d6ec3f16059f"
|
||||||
|
set "_oApp=0ff1ce15-a989-479d-af46-f275c6370663"
|
||||||
|
set "_oA14=59a52881-a989-479d-af46-f275c6370663"
|
||||||
|
|
||||||
|
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName
|
||||||
|
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName /reg:32
|
||||||
|
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort
|
||||||
|
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort /reg:32
|
||||||
|
%nul% reg delete "HKLM\%SPPk%" /f /v DisableDnsPublishing
|
||||||
|
%nul% reg delete "HKLM\%SPPk%" /f /v DisableKeyManagementServiceHostCaching
|
||||||
|
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
|
||||||
|
if %winbuild% GEQ 9200 (
|
||||||
|
%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f
|
||||||
|
%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f /reg:32
|
||||||
|
)
|
||||||
|
if %winbuild% GEQ 9600 (
|
||||||
|
%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_wApp%" /f
|
||||||
|
%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_oApp%" /f
|
||||||
|
)
|
||||||
|
%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServiceName
|
||||||
|
%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServicePort
|
||||||
|
%nul% reg delete "HKLM\%OPPk%" /f /v DisableDnsPublishing
|
||||||
|
%nul% reg delete "HKLM\%OPPk%" /f /v DisableKeyManagementServiceHostCaching
|
||||||
|
%nul% reg delete "HKLM\%OPPk%\%_oA14%" /f
|
||||||
|
%nul% reg delete "HKLM\%OPPk%\%_oApp%" /f
|
||||||
|
|
||||||
|
exit /b
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Fix SPP related registry and folder permissions
|
:: Fix SPP related registry and folder permissions
|
||||||
|
|
||||||
:fixsppperms:
|
:fixsppperms:
|
||||||
@ -1276,7 +1374,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Fix perms for SPP in HKU\S-1-5-20
|
# Fix perms for SPP in HKU\S-1-5-20
|
||||||
# https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
# https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') {
|
if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') {
|
||||||
exit
|
exit
|
||||||
@ -1423,7 +1521,7 @@ exit /b
|
|||||||
|
|
||||||
:regownstart
|
:regownstart
|
||||||
|
|
||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regown\:.*';iex ($f[1]);"
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';. ([scriptblock]::Create($f[1]));"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Below code takes ownership of a volatile registry key and deletes it
|
:: Below code takes ownership of a volatile registry key and deletes it
|
||||||
@ -1455,6 +1553,36 @@ $key.SetAccessControl($acl)
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: This code runs to undo below registry key KMS38 protection
|
||||||
|
:: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
|
|
||||||
|
:: This option is not used in KMS38 anymore, it's here only to remove previous versions protection.
|
||||||
|
|
||||||
|
:regdel:
|
||||||
|
param (
|
||||||
|
[switch]$protect
|
||||||
|
)
|
||||||
|
|
||||||
|
$SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
|
||||||
|
$Admin = ($SID.Translate([System.Security.Principal.NTAccount])).Value
|
||||||
|
|
||||||
|
if($protect) {
|
||||||
|
$ruleArgs = @("$Admin", "Delete, SetValue", "ContainerInherit", "None", "Deny")
|
||||||
|
} else {
|
||||||
|
$ruleArgs = @("$Admin", "FullControl", "Allow")
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f'
|
||||||
|
$key = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey($path, 'ReadWriteSubTree', 'ChangePermissions')
|
||||||
|
$acl = $key.GetAccessControl()
|
||||||
|
|
||||||
|
$rule = [System.Security.AccessControl.RegistryAccessRule]::new.Invoke($ruleArgs)
|
||||||
|
$acl.ResetAccessRule($rule)
|
||||||
|
$key.SetAccessControl($acl)
|
||||||
|
:regdel:
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:dk_color
|
:dk_color
|
||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
@ -1489,7 +1617,7 @@ call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
|||||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 exit /b
|
if !errorlevel!==2 exit /b
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
|
|||||||
234
README.md
234
README.md
@ -1,118 +1,116 @@
|
|||||||
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
||||||
|
|
||||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||||
|
|
||||||
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
## How to Activate Windows / Office?
|
## How to Activate Windows / Office?
|
||||||
|
|
||||||
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
||||||
|
|
||||||
1. **Open PowerShell**
|
1. **Open PowerShell**
|
||||||
To do that, press the Windows key + X, then select PowerShell or Terminal.
|
To do that, press the Windows key + X, then select PowerShell or Terminal.
|
||||||
|
|
||||||
2. **Copy and paste the code below, then press enter.**
|
2. **Copy and paste the code below, then press enter.**
|
||||||
```
|
```
|
||||||
irm https://get.activated.win | iex
|
irm https://get.activated.win | iex
|
||||||
```
|
```
|
||||||
Alternatively, you can use the following (this will be deprecated in the future):
|
Alternatively, you can use the following (this will be deprecated in the future):
|
||||||
```
|
```
|
||||||
irm https://massgrave.dev/get | iex
|
irm https://massgrave.dev/get | iex
|
||||||
```
|
```
|
||||||
|
|
||||||
3. You will see the activation options.
|
3. You will see the activation options. Choose the activation options highlighted in green.
|
||||||
Press 1 HWID for Windows activation.
|
|
||||||
Press 2 Ohook for Office activation.
|
4. That's all
|
||||||
|
|
||||||
4. That's all
|
---
|
||||||
|
|
||||||
---
|
### Method 2 - Traditional (Windows Vista and later)
|
||||||
|
|
||||||
### Method 2 - Traditional (Windows Vista and later)
|
<details>
|
||||||
|
<summary>Click here to view</summary>
|
||||||
<details>
|
|
||||||
<summary>Click here to view</summary>
|
1. Download the file using one of the links below:
|
||||||
|
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
|
||||||
1. Download the file using one of the links below:
|
or
|
||||||
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
|
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
|
||||||
or
|
2. Right-click on the downloaded zip file and extract it.
|
||||||
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
|
3. In the extracted folder, find the folder named `All-In-One-Version`.
|
||||||
2. Right-click on the downloaded zip file and extract it.
|
4. Run the file named `MAS_AIO.cmd`.
|
||||||
3. In the extracted folder, find the folder named `All-In-One-Version`.
|
5. You will see the activation options. Follow the on-screen instructions.
|
||||||
4. Run the file named `MAS_AIO.cmd`.
|
6. That's all.
|
||||||
5. You will see the activation options. Follow the on-screen instructions.
|
|
||||||
6. That's all.
|
</details>
|
||||||
|
|
||||||
</details>
|
---
|
||||||
|
|
||||||
---
|
- To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation).
|
||||||
|
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
||||||
- **[Office for macOS](https://massgrave.dev/office_for_mac)**
|
|
||||||
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
---
|
||||||
|
|
||||||
---
|
### Not working ❓
|
||||||
|
|
||||||
### Not working ❓
|
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
|
||||||
|
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
|
||||||
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
|
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
|
||||||
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
|
|
||||||
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
|
---
|
||||||
|
|
||||||
---
|
> [!NOTE]
|
||||||
|
>
|
||||||
> [!NOTE]
|
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
|
||||||
>
|
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
|
||||||
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
|
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
|
||||||
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
|
|
||||||
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
|
---
|
||||||
|
|
||||||
---
|
```
|
||||||
|
Latest Version: 3.4
|
||||||
```
|
Release date: 3-June-2025
|
||||||
Latest Version: 3.2
|
```
|
||||||
Release date: 6-May-2025
|
|
||||||
```
|
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||||
|
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
||||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
|
||||||
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
<div align="center">
|
||||||
|
|
||||||
<div align="center">
|
[![1.1]][1]
|
||||||
|
[![1.2]][2]
|
||||||
[![1.1]][1]
|
[![1.3]][3]
|
||||||
[![1.2]][2]
|
|
||||||
[![1.3]][3]
|
</div>
|
||||||
|
|
||||||
</div>
|
<div align="center">
|
||||||
|
|
||||||
<div align="center">
|
[![1.4]][4]
|
||||||
|
[![1.5]][5]
|
||||||
[![1.4]][4]
|
[![1.6]][6]
|
||||||
[![1.5]][5]
|
[![1.7]][7]
|
||||||
[![1.6]][6]
|
|
||||||
[![1.7]][7]
|
</div>
|
||||||
|
|
||||||
</div>
|
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
|
||||||
|
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
|
||||||
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
|
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
|
||||||
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
|
|
||||||
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
|
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
||||||
|
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
||||||
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
|
||||||
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
|
||||||
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
|
|
||||||
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
|
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
||||||
|
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
|
||||||
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
|
||||||
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
|
[4]: https://discord.gg/j2yFsV5ZVC
|
||||||
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
|
[5]: https://www.reddit.com/r/MAS_Activator
|
||||||
[4]: https://discord.gg/j2yFsV5ZVC
|
[6]: https://bsky.app/profile/massgrave.dev
|
||||||
[5]: https://www.reddit.com/r/MAS_Activator
|
[7]: https://twitter.com/massgravel
|
||||||
[6]: https://bsky.app/profile/massgrave.dev
|
|
||||||
[7]: https://twitter.com/massgravel
|
---
|
||||||
|
|
||||||
---
|
<p align="center">Made with Love ❤️</p>
|
||||||
|
|
||||||
<p align="center">Made with Love ❤️</p>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user