mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-01-12 11:01:46 +00:00
Compare commits
29 Commits
2dd41cc2c5
...
3.7
| Author | SHA1 | Date | |
|---|---|---|---|
| d940db1e60 | |||
| ab6b572af9 | |||
| 75a4d2e3a7 | |||
| fd2cecb4ec | |||
| a9c2f58741 | |||
| 79012c7db0 | |||
| caffa62abe | |||
| a8f6d051a6 | |||
| 6022b6de10 | |||
| 4ea26906cd | |||
| 564aad78b4 | |||
| d5e382e763 | |||
| 793550725a | |||
| 3917497c82 | |||
| 28c2264d89 | |||
| a51ae62332 | |||
| ffcb641f17 | |||
| 53a2747338 | |||
| 3a99ea4eeb | |||
| e6eaeaa682 | |||
| e2c52b4ac8 | |||
| 31c47b9538 | |||
| 904e96d748 | |||
| 5e2cc4f5cf | |||
| c619a2c381 | |||
| 9c09432b01 | |||
| e476ac66a4 | |||
| dba7213a91 | |||
| 0f38fa3cef |
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -1,4 +1,4 @@
|
||||
# MAS export-ignore
|
||||
# LICENSE export-ignore
|
||||
# README.md export-ignore
|
||||
MAS export-ignore
|
||||
LICENSE export-ignore
|
||||
README.md export-ignore
|
||||
.gitattributes export-ignore
|
||||
|
||||
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.4
|
||||
@set masver=3.7
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -50,6 +50,7 @@ set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
@ -173,6 +174,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
sc query gcs | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Windows Sandbox detected; activation is not supported.
|
||||
echo The script cannot run due to missing licensing components. Aborting...
|
||||
echo:
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -269,6 +280,9 @@ REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -283,13 +297,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
@ -701,7 +728,7 @@ call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Of
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: mass<>grave<.>dev/office-license-is-not-genuine
|
||||
:: mass()grave(dot)dev/office-license-is-not-genuine
|
||||
:: Add registry keys for volume products so that 'non-genuine' banner won't appear
|
||||
:: Script already is using MAK instead of GVLK so it won't appear anyway, but registry keys are added incase Office installs default GVLK grace key for volume products
|
||||
|
||||
@ -743,7 +770,7 @@ if defined ohub call :dk_color %Gray% "Office apps such as Word, Excel are activ
|
||||
echo Help: %mas%troubleshoot
|
||||
) else (
|
||||
call :dk_color %Red% "Some errors were detected."
|
||||
if not defined ierror if not defined showfix if not defined serv_cor if not defined serv_cste call :dk_color %Blue% "%_fixmsg%"
|
||||
if not defined ierror if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
@ -1448,10 +1475,12 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
|
||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||
|
||||
set vnextexist=
|
||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||
|
||||
for %%x in (15 16) do (
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg query HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
|
||||
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul%
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
@ -1474,6 +1503,7 @@ rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\L
|
||||
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
|
||||
set defname=DEFTEMP-%%#
|
||||
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
|
||||
reg query HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
|
||||
reg unload HKU\!defname! %nul%
|
||||
)
|
||||
@ -1481,6 +1511,15 @@ reg unload HKU\!defname! %nul%
|
||||
)
|
||||
)
|
||||
|
||||
if defined vnextexist (
|
||||
echo:
|
||||
call :dk_color %Gray% "Office vNext subscription detected:"
|
||||
call :dk_color %Blue% "If active, this license overrides other activation methods."
|
||||
call :dk_color %Blue% "If expiring soon, rerun the script after expiration."
|
||||
call :dk_color2 %Blue% "If expired and script activation fails, get help - " %_Yellow% " %mas%troubleshoot"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Clear SharedComputerLicensing for office
|
||||
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
|
||||
|
||||
@ -1575,7 +1614,15 @@ set upk_result=2
|
||||
|
||||
if defined ohookact if not %upk_result%==0 echo:
|
||||
if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
|
||||
if %upk_result%==2 call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
|
||||
if %upk_result%==2 (
|
||||
call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1628,7 +1675,7 @@ exit /b
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
@ -1717,9 +1764,11 @@ if %sps%==SoftwareLicensingService call :dk_refresh
|
||||
echo %keyecho% %~1 [Successful]
|
||||
) else (
|
||||
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
|
||||
if not defined error (
|
||||
if not defined showfix (
|
||||
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
set showfix=1
|
||||
)
|
||||
set error=1
|
||||
@ -1873,6 +1922,7 @@ if not "%results%%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% "%results%"&set showfix=1)
|
||||
echo:
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
@ -1893,40 +1943,118 @@ exit /b
|
||||
set showfix=
|
||||
call :dk_chkmal
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check Sandboxing
|
||||
|
||||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
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
|
||||
|
||||
set serv_cor=
|
||||
for %%# in (%_serv%) do (
|
||||
set _regcorr=
|
||||
set _corrupt=
|
||||
sc start %%# %nul%
|
||||
if !errorlevel! EQU 1060 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 (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1
|
||||
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&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 (
|
||||
set error=1
|
||||
set showfix=1
|
||||
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
|
||||
|
||||
@ -1961,11 +2089,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_cste (
|
||||
set error=1
|
||||
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
|
||||
:: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions
|
||||
@ -1987,119 +2130,25 @@ if defined checkerror if defined serv_e (set "serv_e=!serv_e!, %%#-!errorcode!")
|
||||
)
|
||||
|
||||
if defined serv_e (
|
||||
set error=1
|
||||
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
|
||||
)
|
||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||
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/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% && (
|
||||
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% && (
|
||||
echo:
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
|
||||
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:
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
set wpainfo=
|
||||
set wpaerror=
|
||||
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
|
||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
||||
|
||||
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% || (
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
if not %osedition%==0 (
|
||||
if "%osSKU%"=="164" set osedition=ProfessionalEducation
|
||||
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
|
||||
)
|
||||
|
||||
if not defined notwinact (
|
||||
if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) 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" (
|
||||
set skunotfound=1
|
||||
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%Edition*.mum" (
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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 (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
|
||||
)
|
||||
|
||||
:: Check WMI
|
||||
|
||||
set wmifailed=
|
||||
if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
|
||||
@ -2107,168 +2156,94 @@ if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Objec
|
||||
|
||||
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 %winbuild% GEQ 10240 (
|
||||
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
|
||||
set /a "sum/=3"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
||||
echo:
|
||||
)
|
||||
) else (
|
||||
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
|
||||
set /a "sum/=2"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
)
|
||||
|
||||
|
||||
:: 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.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
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 (
|
||||
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=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
echo Checking SPP In IFEO [%_sppint%]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
)
|
||||
|
||||
:: Check SPP Registry Key
|
||||
|
||||
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% || (
|
||||
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 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
|
||||
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%\]"
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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=[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 (
|
||||
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" (
|
||||
%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)
|
||||
echo !taskinfo! | find /i "Ready" %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
|
||||
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."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: 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 (
|
||||
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"
|
||||
@ -2296,29 +2271,299 @@ 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 (
|
||||
set showfix=1
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
||||
echo:
|
||||
)
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
||||
if not defined showfix if defined wpaerror (
|
||||
::==============================
|
||||
|
||||
:: 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%]"
|
||||
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
|
||||
call :dk_color %Blue% "If activation fails then go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
|
||||
)
|
||||
)
|
||||
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%]
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: 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%
|
||||
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
|
||||
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 not defined showfix if defined rlicfailed (
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
||||
echo:
|
||||
)
|
||||
|
||||
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" (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
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
|
||||
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
|
||||
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 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
if not %osedition%==0 (
|
||||
if "%osSKU%"=="164" set osedition=ProfessionalEducation
|
||||
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
|
||||
)
|
||||
|
||||
if not defined notwinact (
|
||||
if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) 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" (
|
||||
set skunotfound=1
|
||||
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%Edition*.mum" (
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check SKU value to find if there is any difference
|
||||
|
||||
if not defined notwinact (
|
||||
if %winbuild% GEQ 10240 (
|
||||
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
|
||||
set /a "sum/=3"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
|
||||
)
|
||||
) else (
|
||||
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
|
||||
set /a "sum/=2"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: 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.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check SPP interference in IFEO
|
||||
|
||||
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=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
)
|
||||
set showfix=1
|
||||
) || (
|
||||
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 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
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"
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check SvcRestartTask status, this task helps in making sure system remains activated
|
||||
|
||||
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% || (
|
||||
for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
|
||||
|
||||
echo !taskinfo! | find /i "Ready" %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
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
|
||||
call :dk_color %Gray% "Checking SvcRestartTask Status [!taskinfo!. System might deactivate later.]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
) || (
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
|
||||
)
|
||||
echo:
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
exit /b
|
||||
|
||||
@ -2441,7 +2686,6 @@ exit /b
|
||||
|
||||
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_Retail________ExcelR_[HSExcelR]
|
||||
14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR
|
||||
14_fbf4ac36-31c8-4340-8666-79873129cf40_Retail________OutlookR
|
||||
14_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR]
|
||||
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR]
|
||||
14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR]
|
||||
@ -2470,6 +2714,7 @@ for %%# in (
|
||||
14_85e22450-b741-430c-a172-a37962c938af_6GKT2-KMJPK-4RRBF-8VQKB-JB%f%6G6_MAK___________InfoPathVL
|
||||
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_2TG3P-9DB76-4YT99-8RXGD-CW%f%XBP_Retail________OneNoteR_[HSOneNoteR]
|
||||
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_CV64P-F4VRH-BJ33D-PH6MR-X6%f%9RY_MAK___________OneNoteVL
|
||||
14_fbf4ac36-31c8-4340-8666-79873129cf40_9D8FR-7GYBW-4YG8M-V36JK-VD%f%7CM_Retail________OutlookR
|
||||
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_J8C9M-YXMH2-9CX44-2C3YG-V7%f%692_MAK___________OutlookVL
|
||||
14_acb51361-c0db-4895-9497-1831c41f31a6_GMBWM-WVX26-7WHV4-DB43D-WV%f%DY2_Retail________PersonalR_[PersonalDemoR,PersonalPrepaidR]
|
||||
14_38252940-718c-4aa6-81a4-135398e53851_HPBQP-RJHDR-Q3472-PT9Q6-PB%f%B72_MAK___________PowerPointVL
|
||||
@ -2988,13 +3233,13 @@ $MemoryStream.Close()
|
||||
::
|
||||
:: The files are encoded in base64 to make AIO version.
|
||||
::
|
||||
:: mass<>grave<.>dev/ohook
|
||||
:: mass()grave(dot)dev/ohook
|
||||
:: Here you can find the files source code and info on how to rebuild the identical sppc.dll files
|
||||
::
|
||||
:: stackoverflow.com/a/35335273
|
||||
:: Here you can check how to extract sppc.dll files from base64
|
||||
::
|
||||
:: For any further question, feel free to contact us on mass<>grave<.>dev/contactus
|
||||
:: For any further question, feel free to contact us on mass()grave(dot)dev/contactus
|
||||
::
|
||||
::========================================================================================================================================
|
||||
::
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
@set masver=3.4
|
||||
@set masver=3.7
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -75,6 +75,7 @@ set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
@ -204,6 +205,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
sc query gcs | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Windows Sandbox detected; activation is not supported.
|
||||
echo The script cannot run due to missing licensing components. Aborting...
|
||||
echo:
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -300,6 +311,9 @@ REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -314,13 +328,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
@ -1004,7 +1031,7 @@ if %winbuild% GEQ 9200 (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" set "_C16R=1"
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath /reg:32" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" set "_C16R=1"
|
||||
if defined _C16R (
|
||||
REM mass<>grave<.>dev/office-license-is-not-genuine
|
||||
REM mass()grave(dot)dev/office-license-is-not-genuine
|
||||
set _server=10.0.0.10
|
||||
call :_taskregserv
|
||||
echo Keeping the non-existent IP address 10.0.0.10 as %KS% Server.
|
||||
@ -1426,10 +1453,12 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
|
||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||
|
||||
set vnextexist=
|
||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||
|
||||
for %%x in (15 16) do (
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg query HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
|
||||
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul%
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
@ -1452,6 +1481,7 @@ rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\L
|
||||
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
|
||||
set defname=DEFTEMP-%%#
|
||||
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
|
||||
reg query HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
|
||||
reg unload HKU\!defname! %nul%
|
||||
)
|
||||
@ -1459,6 +1489,15 @@ reg unload HKU\!defname! %nul%
|
||||
)
|
||||
)
|
||||
|
||||
if defined vnextexist (
|
||||
echo:
|
||||
call :dk_color %Gray% "Office vNext subscription detected:"
|
||||
call :dk_color %Blue% "If active, this license overrides other activation methods."
|
||||
call :dk_color %Blue% "If expiring soon, rerun the script after expiration."
|
||||
call :dk_color2 %Blue% "If expired and script activation fails, get help - " %_Yellow% " %mas%troubleshoot"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Clear SharedComputerLicensing for office
|
||||
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
|
||||
|
||||
@ -1553,7 +1592,15 @@ set upk_result=2
|
||||
|
||||
if defined ohookact if not %upk_result%==0 echo:
|
||||
if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
|
||||
if %upk_result%==2 call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
|
||||
if %upk_result%==2 (
|
||||
call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1602,6 +1649,9 @@ call :ks_clearstuff
|
||||
set error_=9
|
||||
echo Failed to completely clear %KS% Cache.
|
||||
reg query "HKLM\%SPPk%\%_wApp%" /s %nul2% | findstr /i "127.0.0.2" %nul1% && echo KMS38 activation is locked.
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
) || (
|
||||
echo Cleared %KS% Cache successfully.
|
||||
)
|
||||
@ -1617,6 +1667,10 @@ echo %uline%
|
||||
echo %uline%
|
||||
echo:
|
||||
call :dk_color %Green% "Online %KS% has been successfully uninstalled."
|
||||
echo:
|
||||
call :dk_color %Gray% "If you want to reset the activation status,"
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
echo %uline%
|
||||
)
|
||||
|
||||
@ -1673,7 +1727,7 @@ exit /b
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -1714,7 +1768,7 @@ set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowe
|
||||
set _tserror=
|
||||
set winbuild=1
|
||||
set "nul=>nul 2>&1"
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
set psc=powershell.exe -nop -c
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
@ -2534,7 +2588,7 @@ exit /b
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
@ -2686,9 +2740,11 @@ if %sps%==SoftwareLicensingService call :dk_refresh
|
||||
echo %keyecho% %~1 [Successful]
|
||||
) else (
|
||||
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
|
||||
if not defined error (
|
||||
if not defined showfix (
|
||||
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
set showfix=1
|
||||
)
|
||||
set error=1
|
||||
@ -2929,6 +2985,7 @@ if not "%results%%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% "%results%"&set showfix=1)
|
||||
echo:
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
@ -2949,40 +3006,118 @@ exit /b
|
||||
set showfix=
|
||||
call :dk_chkmal
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check Sandboxing
|
||||
|
||||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
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
|
||||
|
||||
set serv_cor=
|
||||
for %%# in (%_serv%) do (
|
||||
set _regcorr=
|
||||
set _corrupt=
|
||||
sc start %%# %nul%
|
||||
if !errorlevel! EQU 1060 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 (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1
|
||||
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&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 (
|
||||
set error=1
|
||||
set showfix=1
|
||||
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
|
||||
|
||||
@ -3017,11 +3152,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_cste (
|
||||
set error=1
|
||||
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
|
||||
:: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions
|
||||
@ -3043,119 +3193,25 @@ if defined checkerror if defined serv_e (set "serv_e=!serv_e!, %%#-!errorcode!")
|
||||
)
|
||||
|
||||
if defined serv_e (
|
||||
set error=1
|
||||
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
|
||||
)
|
||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||
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/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% && (
|
||||
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% && (
|
||||
echo:
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
|
||||
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:
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
set wpainfo=
|
||||
set wpaerror=
|
||||
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
|
||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
||||
|
||||
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% || (
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
if not %osedition%==0 (
|
||||
if "%osSKU%"=="164" set osedition=ProfessionalEducation
|
||||
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
|
||||
)
|
||||
|
||||
if not defined notwinact (
|
||||
if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) 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" (
|
||||
set skunotfound=1
|
||||
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%Edition*.mum" (
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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 (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
|
||||
)
|
||||
|
||||
:: Check WMI
|
||||
|
||||
set wmifailed=
|
||||
if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
|
||||
@ -3163,168 +3219,94 @@ if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Objec
|
||||
|
||||
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 %winbuild% GEQ 10240 (
|
||||
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
|
||||
set /a "sum/=3"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
||||
echo:
|
||||
)
|
||||
) else (
|
||||
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
|
||||
set /a "sum/=2"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
)
|
||||
|
||||
|
||||
:: 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.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
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 (
|
||||
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=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
echo Checking SPP In IFEO [%_sppint%]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
)
|
||||
|
||||
:: Check SPP Registry Key
|
||||
|
||||
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% || (
|
||||
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 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
|
||||
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%\]"
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
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=[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 (
|
||||
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" (
|
||||
%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)
|
||||
echo !taskinfo! | find /i "Ready" %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
|
||||
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."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: 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 (
|
||||
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"
|
||||
@ -3352,29 +3334,299 @@ 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 (
|
||||
set showfix=1
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
||||
echo:
|
||||
)
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
||||
if not defined showfix if defined wpaerror (
|
||||
::==============================
|
||||
|
||||
:: 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%]"
|
||||
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
|
||||
call :dk_color %Blue% "If activation fails then go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
|
||||
)
|
||||
)
|
||||
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%]
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: 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%
|
||||
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
|
||||
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 not defined showfix if defined rlicfailed (
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
|
||||
echo:
|
||||
)
|
||||
|
||||
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" (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
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
|
||||
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
|
||||
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 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
if not %osedition%==0 (
|
||||
if "%osSKU%"=="164" set osedition=ProfessionalEducation
|
||||
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
|
||||
)
|
||||
|
||||
if not defined notwinact (
|
||||
if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) 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" (
|
||||
set skunotfound=1
|
||||
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%Edition*.mum" (
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check SKU value to find if there is any difference
|
||||
|
||||
if not defined notwinact (
|
||||
if %winbuild% GEQ 10240 (
|
||||
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
|
||||
set /a "sum/=3"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
|
||||
)
|
||||
) else (
|
||||
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
|
||||
set /a "sum/=2"
|
||||
if not "!sum!"=="%slcSKU%" (
|
||||
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: 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.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check SPP interference in IFEO
|
||||
|
||||
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=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
echo:
|
||||
)
|
||||
set showfix=1
|
||||
) || (
|
||||
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 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
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"
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
:: Check SvcRestartTask status, this task helps in making sure system remains activated
|
||||
|
||||
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% || (
|
||||
for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
|
||||
|
||||
echo !taskinfo! | find /i "Ready" %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
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
|
||||
call :dk_color %Gray% "Checking SvcRestartTask Status [!taskinfo!. System might deactivate later.]"
|
||||
if not defined showfix (
|
||||
echo:
|
||||
echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
) || (
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
|
||||
)
|
||||
echo:
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==============================
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
||||
@set masver=3.4
|
||||
@set masver=3.7
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
@ -135,6 +136,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
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 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -214,6 +225,9 @@ REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -228,13 +242,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
@ -1521,7 +1548,7 @@ if ($appIdsList.Count -gt 0) {
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
@set masver=3.4
|
||||
@set masver=3.7
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -42,6 +42,7 @@ set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
@ -140,6 +141,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
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 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -219,6 +230,9 @@ REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -233,13 +247,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
@ -844,7 +871,7 @@ exit /b
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
@set masver=3.4
|
||||
@set masver=3.7
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
@ -134,6 +135,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto done2
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
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 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -230,6 +241,9 @@ REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto done2
|
||||
)
|
||||
|
||||
@ -244,13 +258,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto done2
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
@ -769,7 +796,7 @@ exit /b
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
@set masver=3.4
|
||||
@set masver=3.7
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Homepage: mass()grave(dot)dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
@ -135,6 +136,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
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 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -231,6 +242,9 @@ REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -245,13 +259,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
@ -1629,7 +1656,7 @@ exit /b
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
|
||||
61
README.md
61
README.md
@ -6,25 +6,42 @@
|
||||
|
||||
<hr>
|
||||
|
||||
## How to Activate Windows / Office?
|
||||
## How to Activate Windows / Office / Extended Updates (ESU)?
|
||||
|
||||
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
||||
### Method 1 - PowerShell ❤️
|
||||
|
||||
1. **Open PowerShell**
|
||||
To do that, press the Windows key + X, then select PowerShell or Terminal.
|
||||
1. **Open PowerShell**
|
||||
Click the **Start Menu**, type `PowerShell`, then open it.
|
||||
|
||||
2. **Copy and paste the code below, then press enter.**
|
||||
```
|
||||
irm https://get.activated.win | iex
|
||||
```
|
||||
Alternatively, you can use the following (this will be deprecated in the future):
|
||||
```
|
||||
irm https://massgrave.dev/get | iex
|
||||
```
|
||||
2. **Copy and paste the code below, then press enter.**
|
||||
- For **Windows 8, 10, 11**: 📌
|
||||
```
|
||||
irm https://get.activated.win | iex
|
||||
```
|
||||
- For **Windows 7** and later:
|
||||
```
|
||||
iex ((New-Object Net.WebClient).DownloadString('https://get.activated.win'))
|
||||
```
|
||||
|
||||
3. You will see the activation options. Choose the activation options highlighted in green.
|
||||
<details>
|
||||
|
||||
4. That's all
|
||||
<summary>Script not launching❓Click here for info.</summary>
|
||||
|
||||
---
|
||||
|
||||
- If the above is blocked (by ISP/DNS), try this (needs **updated Windows 10 or 11**):
|
||||
```
|
||||
iex (curl.exe -s --doh-url https://1.1.1.1/dns-query https://get.activated.win | Out-String)
|
||||
```
|
||||
- If that fails or you have an older Windows, use the below-listed Method 2.
|
||||
|
||||
---
|
||||
|
||||
</details>
|
||||
|
||||
3. The activation menu will appear. **Choose the green-highlighted options** to activate Windows or Office.
|
||||
|
||||
4. **Done!**
|
||||
|
||||
---
|
||||
|
||||
@ -47,16 +64,14 @@ or
|
||||
|
||||
---
|
||||
|
||||
- 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).
|
||||
> [!TIP]
|
||||
> - Some ISPs/DNS block access to our domains. You can bypass this by enabling [DNS-over-HTTPS (DoH)](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/encrypted-dns-browsers/) in your browser.
|
||||
> - **Having trouble**❓Visit our [troubleshooting page](https://massgrave.dev/troubleshoot) or raise an issue on [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts/issues).
|
||||
|
||||
---
|
||||
|
||||
### 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 have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
|
||||
- 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).
|
||||
|
||||
---
|
||||
|
||||
@ -69,8 +84,8 @@ or
|
||||
---
|
||||
|
||||
```
|
||||
Latest Version: 3.4
|
||||
Release date: 3-June-2025
|
||||
Latest Version: 3.7
|
||||
Release date: 11-Sep-2025
|
||||
```
|
||||
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||
|
||||
Reference in New Issue
Block a user