Fix many grammar/spelling issues in the script (#543)

* Proof-read Change Edition script

* .

* Proof-read OEM folder script

* Update Change_Edition.cmd

* Update Troubleshoot.cmd

* Update Troubleshoot.cmd

* Update HWID_Activation.cmd

* Update HWID_Activation.cmd

* Update HWID_Activation.cmd

* Update KMS38_Activation.cmd

* Add files via upload

* Update Change_Edition.cmd

* I'm tired

* Update Extract_OEM_Folder.cmd

* Update Troubleshoot.cmd

* Update HWID_Activation.cmd

* Update HWID_Activation.cmd

* Update HWID_Activation.cmd

* finish with hwid

* Update KMS38_Activation.cmd

* final kms38 update

* Update Ohook_Activation_AIO.cmd

* start ohook

* Update Ohook_Activation_AIO.cmd

* Update Online_KMS_Activation.cmd

* Update HWID_Activation.cmd

* Update KMS38_Activation.cmd

* Update Ohook_Activation_AIO.cmd

* Update Online_KMS_Activation.cmd

* Update Change_Edition.cmd

* Update Extract_OEM_Folder.cmd

* Update Troubleshoot.cmd

---------

Co-authored-by: nekoppai <109633131+nekoppai@users.noreply.github.com>
Co-authored-by: WindowsAddict <windowsaddict@protonmail.com>
This commit is contained in:
Lyssa 2024-08-20 12:15:06 -05:00 committed by GitHub
parent d372b62280
commit 19be25c029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 303 additions and 298 deletions

View File

@ -27,7 +27,7 @@ set "_debug=0"
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -160,22 +160,22 @@ call :dk_setvar
if %winbuild% LSS 10240 ( if %winbuild% LSS 10240 (
%eline% %eline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo HWID Activation is supported only for Windows 10/11. echo HWID Activation is only supported on Windows 10/11.
echo: echo:
call :dk_color %Blue% "Use Online KMS Activation option." call :dk_color %Blue% "Use Online KMS activation option."
goto dk_done goto dk_done
) )
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
%eline% %eline%
echo HWID Activation is not supported for Windows Server. echo HWID Activation is not supported on Windows Server.
call :dk_color %Blue% "Use KMS38 or Online KMS Activation option." call :dk_color %Blue% "Use KMS38 or Online KMS activation option."
goto dk_done goto dk_done
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -195,8 +195,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto dk_done goto dk_done
@ -237,7 +237,7 @@ goto dk_done
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto dk_done goto dk_done
) )
@ -296,14 +296,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -329,7 +329,7 @@ ClipUp.exe
) do ( ) do (
if not exist %SysPath%\%%# ( if not exist %SysPath%\%%# (
%eline% %eline%
echo [%SysPath%\%%#] file is missing. Aborting... echo [%SysPath%\%%#] file is missing, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -356,12 +356,12 @@ if defined _perm (
cls cls
echo ___________________________________________________________________________________________ echo ___________________________________________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %Green% "Checking: %winos% is Permanently Activated." call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
call :dk_color2 %_White% " " %Gray% "Activation is not required." call :dk_color2 %_White% " " %Gray% "Activation is not required."
echo ___________________________________________________________________________________________ echo ___________________________________________________________________________________________
if %_unattended%==1 goto dk_done if %_unattended%==1 goto dk_done
echo: echo:
choice /C:10 /N /M "> [1] Activate [0] %_exitmsg% : " choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
if errorlevel 2 exit /b if errorlevel 2 exit /b
) )
cls cls
@ -375,7 +375,7 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2
%eline% %eline%
echo [%winos% ^| %winbuild%] echo [%winos% ^| %winbuild%]
echo: echo:
echo Evaluation Editions cannot be activated outside of evaluation period. echo Evaluation editions cannot be activated outside of their evaluation period.
echo: echo:
set fixes=%fixes% %mas%evaluation_editions set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -408,7 +408,7 @@ echo Checking Internet Connection [Connected%ping_f%]
) else ( ) else (
set error=1 set error=1
call :dk_color %Red% "Checking Internet Connection [Not Connected]" call :dk_color %Red% "Checking Internet Connection [Not Connected]"
call :dk_color %Blue% "Internet is required for HWID Activation." call :dk_color %Blue% "Internet is required for HWID activation."
) )
::======================================================================================================================================== ::========================================================================================================================================
@ -457,13 +457,13 @@ if not defined key (
%eline% %eline%
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound ( if not defined skunotfound (
echo This product does not support HWID Activation. echo This product does not support HWID activation.
echo Try KMS38 Activation option. echo Make sure you are using the latest version of the script.
echo Make sure you are using updated version of the script. echo If you are, then try KMS38 activation option.
set fixes=%fixes% %mas% set fixes=%fixes% %mas%
echo %mas% echo %mas%
) else ( ) else (
echo Required License files not found in %SysPath%\spp\tokens\skus\ echo Required license files not found in %SysPath%\spp\tokens\skus\
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -479,12 +479,12 @@ if defined notworking set error=1
echo: echo:
if defined changekey ( if defined changekey (
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable HWID activation." call :dk_color %Blue% "[%altedition%] edition product key will be used to enable HWID activation."
echo: echo:
) )
if defined winsub ( if defined winsub (
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]." call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script will activate base edition [SKU ID-%regSKU%]."
echo: echo:
) )
@ -526,7 +526,7 @@ call :hwiddata ticket
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul% copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
if not exist "%tdir%\GenuineTicket.xml" ( if not exist "%tdir%\GenuineTicket.xml" (
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]" call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
echo [%encoded%] echo [%encoded%]
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul% if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
goto :dl_final goto :dl_final
@ -544,7 +544,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
%_xmlexist% ( %_xmlexist% (
set error=1 set error=1
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul% if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]" call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
) )
) )
@ -604,7 +604,7 @@ reg delete "%_ident%" /f %nul%
reg query "%_ident%" %nul% && ( reg query "%_ident%" %nul% && (
echo: echo:
set error=1 set error=1
call :dk_color %Red% "Deleting an IdentityCRL Registry [Failed] [%_ident%]" call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]"
) )
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null") for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
call :dk_refresh call :dk_refresh
@ -639,7 +639,7 @@ if not defined resfail (
if defined resfail ( if defined resfail (
set error=1 set error=1
echo: echo:
call :dk_color %Red% "Checking Licensing Servers [Failed To Connect]" call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]"
set fixes=%fixes% %mas%licensing-servers-issue set fixes=%fixes% %mas%licensing-servers-issue
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
) )
@ -702,8 +702,8 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
) else ( ) else (
call :dk_color %Red% "Activation Failed %error_code%" call :dk_color %Red% "Activation Failed %error_code%"
if defined notworking ( if defined notworking (
call :dk_color %Blue% "At the time of writing this, HWID Activation was not supported for this product." call :dk_color %Blue% "At the time of writing, HWID Activation is not supported for this product."
call :dk_color %Blue% "Use KMS38 Activation option." call :dk_color %Blue% "Use KMS38 activation option instead."
) else ( ) else (
if not defined error call :dk_color %Blue% "%_fixmsg%" if not defined error call :dk_color %Blue% "%_fixmsg%"
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@ -1072,7 +1072,7 @@ set pupfound=%pupfound1%%pupfound2%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[AV URLs are blocked in hosts]" if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0 set wucount=0
for %%# in (wuauserv) do ( for %%# in (wuauserv) do (
@ -1081,7 +1081,7 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1) reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
) )
) )
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
@ -1092,7 +1092,8 @@ if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@ -1111,7 +1112,7 @@ call :dk_chkmal
sc query Null %nul% || ( sc query Null %nul% || (
set error=1 set error=1
set showfix=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.]"
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo: echo:
) )
@ -1202,7 +1203,7 @@ if defined serv_e (
set error=1 set error=1
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && ( echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Restart the system to fix this error." call :dk_color %Blue% "Restart your system to fix this error."
set showfix=1 set showfix=1
) )
) )
@ -1242,7 +1243,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]" call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || ( ) || (
echo Checking WPA Registry Count [%wpainfo%] echo Checking WPA Registry Count [%wpainfo%]
) )
@ -1281,7 +1282,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1 set error=1
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]" call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
) )
) )
) )
@ -1352,7 +1353,7 @@ echo Checking Eval WLMS Service [Found]
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]" call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -1377,7 +1378,7 @@ set error=1
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( 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]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1407,9 +1408,9 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;" set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul% %psc% "!d!" %nul%
if exist "%tokenstore%\" ( if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]" call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else ( ) else (
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]" call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1527,7 +1528,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
} }
for ($i=1; $i -le $count; $i++) { for ($i=1; $i -le $count; $i++) {
if (-not $subkeyHashTable.ContainsKey("$i")) { if (-not $subkeyHashTable.ContainsKey("$i")) {
Write-Output "Total Keys $count. Error Found- $i key does not exist" Write-Output "Total Keys $count. Error Found - $i key does not exist."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1538,7 +1539,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
if ($PSVersionTable.PSVersion.Major -lt 3) { if ($PSVersionTable.PSVersion.Major -lt 3) {
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1546,7 +1547,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
$subkey = $wpaKey.OpenSubKey($_) $subkey = $wpaKey.OpenSubKey($_)
$p = $subkey.GetValueNames() $p = $subkey.GetValueNames()
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) { if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1585,13 +1586,13 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."

View File

@ -30,7 +30,7 @@ set "_debug=0"
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -166,19 +166,19 @@ set "specific_kms=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectio
if %winbuild% LSS 14393 ( if %winbuild% LSS 14393 (
%eline% %eline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo KMS38 Activation is supported for Windows 10/11/Server, build 14393 and later. echo KMS38 activation is only supported on Windows 10/11/Server, build 14393 and later.
echo: echo:
if %winbuild% LSS 10240 ( if %winbuild% LSS 10240 (
call :dk_color %Blue% "Use Online KMS Activation option." call :dk_color %Blue% "Use Online KMS activation option."
) else ( ) else (
call :dk_color %Blue% "Use HWID Activation option." call :dk_color %Blue% "Use HWID activation option."
) )
goto dk_done goto dk_done
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -198,8 +198,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto dk_done goto dk_done
@ -240,7 +240,7 @@ goto dk_done
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto dk_done goto dk_done
) )
@ -299,14 +299,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -339,7 +339,7 @@ echo:
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo ____________________________________________________________ echo ____________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,0]" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]"
choice /C:120 /N choice /C:120 /N
set _el=!errorlevel! set _el=!errorlevel!
if !_el!==3 exit /b if !_el!==3 exit /b
@ -369,7 +369,7 @@ if not exist %SysPath%\ClipUp.exe if not defined a_cor (set _fmiss=%_fmiss%ClipU
if defined _fmiss ( if defined _fmiss (
%eline% %eline%
echo [%_fmiss%] file is missing. Aborting... echo [%_fmiss%] file is missing, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -395,12 +395,12 @@ if defined _perm (
cls cls
echo ___________________________________________________________________________________________ echo ___________________________________________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %Green% "Checking: %winos% is Permanently Activated." call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
call :dk_color2 %_White% " " %Gray% "Activation is not required." call :dk_color2 %_White% " " %Gray% "Activation is not required."
echo ___________________________________________________________________________________________ echo ___________________________________________________________________________________________
if %_unattended%==1 goto dk_done if %_unattended%==1 goto dk_done
echo: echo:
choice /C:10 /N /M "> [1] Activate [0] %_exitmsg% : " choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
if errorlevel 2 exit /b if errorlevel 2 exit /b
) )
cls cls
@ -425,7 +425,7 @@ echo Server Evaluation cannot be activated. Convert it to full Server OS.
echo: echo:
call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option." call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
) else ( ) else (
echo Evaluation Editions cannot be activated outside of evaluation period. echo Evaluation editions cannot be activated outside of their evaluation period.
echo: echo:
set fixes=%fixes% %mas%evaluation_editions set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -441,9 +441,9 @@ goto dk_done
if defined a_cor ( if defined a_cor (
if not exist "!_work!\clipup.exe" ( if not exist "!_work!\clipup.exe" (
%eline% %eline%
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] version. echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
echo It's required for KMS38 Activation. echo The file is required for KMS38 activation.
echo Check below page on how to activate it. echo Check the below page for instructions on how to activate it.
set fixes=%fixes% %mas%kms38 set fixes=%fixes% %mas%kms38
echo %mas%kms38 echo %mas%kms38
goto dk_done goto dk_done
@ -496,24 +496,24 @@ set /a UBR=0
if %osSKU%==191 if defined altkey if defined altedition ( if %osSKU%==191 if defined altkey if defined altedition (
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
if %winbuild% LSS 22598 if !UBR! LSS 2788 ( if %winbuild% LSS 22598 if !UBR! LSS 2788 (
call :dk_color %Blue% "Windows must to be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation." call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
) )
) )
if not defined key if defined notfoundaltactID ( if not defined key if defined notfoundaltactID (
call :dk_color %Red% "Checking Alternate Edition For KMS38 [%altedition% Activation ID Not Found]" call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Activation ID Not Found]"
) )
if not defined key if not defined _gvlk ( if not defined key if not defined _gvlk (
%eline% %eline%
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound ( if not defined skunotfound (
echo This product does not support KMS38 Activation. echo This product does not support KMS38 activation.
echo Make sure you are using updated version of the script. echo Make sure you are using the latest version of the script.
set fixes=%fixes% %mas% set fixes=%fixes% %mas%
echo %mas% echo %mas%
) else ( ) else (
echo Required License files not found in %SysPath%\spp\tokens\skus\ echo Required license files were not found in %SysPath%\spp\tokens\skus\
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -527,12 +527,12 @@ goto dk_done
echo: echo:
if defined changekey ( if defined changekey (
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable KMS38 activation." call :dk_color %Blue% "[%altedition%] edition product key will be used to enable KMS38 activation."
echo: echo:
) )
if defined winsub ( if defined winsub (
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]." call :dk_color %Blue% "Windows Subscription edition [SKU ID-%slcSKU%] found. Script will activate the base edition [SKU ID-%regSKU%]."
echo: echo:
) )
@ -629,7 +629,7 @@ set "sessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAV
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul% copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
if not exist "%tdir%\GenuineTicket.xml" ( if not exist "%tdir%\GenuineTicket.xml" (
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]" call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul% if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
goto :k_final goto :k_final
) else ( ) else (
@ -656,7 +656,7 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
%_xmlexist% ( %_xmlexist% (
set error=1 set error=1
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul% if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]" call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
) )
) )
@ -732,16 +732,16 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
:k_final :k_final
:: Remove the added Specific KMS Host (Local Host) if activation is not completed :: Remove the specific KMS host (LocalHost) added by the script if activation is not completed
echo: echo:
if not defined _k38 ( if not defined _k38 (
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
call :dk_color %Red% "Removing The Added Specific KMS Host [Failed]" call :dk_color %Red% "Removing the Added Specific KMS Host [Failed]"
) || ( ) || (
echo Removing The Added Specific KMS Host [Successful] echo Removing the Added Specific KMS Host [Successful]
) )
) )
@ -751,9 +751,9 @@ if defined _k38 (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect" %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
echo Protect KMS38 From KMS [Successful] [Locked A Registry Key] echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
) || ( ) || (
call :dk_color %Red% "Protect KMS38 From KMS [Failed To Lock A Registry Key]" call :dk_color %Red% "Protect KMS38 From KMS [Failed to Lock a Registry Key]"
) )
) )
@ -763,9 +763,9 @@ if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul%
if defined a_cor ( if defined a_cor (
if exist "%_clipup%" ( if exist "%_clipup%" (
call :dk_color %Red% "Deleting copied clipup.exe file [Failed]" call :dk_color %Red% "Deleting Copied clipup.exe File [Failed]"
) else ( ) else (
echo Deleting copied clipup.exe file [Successful] echo Deleting Copied clipup.exe File [Successful]
) )
) )
@ -1215,7 +1215,7 @@ set pupfound=%pupfound1%%pupfound2%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[AV URLs are blocked in hosts]" if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0 set wucount=0
for %%# in (wuauserv) do ( for %%# in (wuauserv) do (
@ -1224,7 +1224,7 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1) reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
) )
) )
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
@ -1235,7 +1235,8 @@ if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@ -1254,7 +1255,7 @@ call :dk_chkmal
sc query Null %nul% || ( sc query Null %nul% || (
set error=1 set error=1
set showfix=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.]"
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo: echo:
) )
@ -1345,7 +1346,7 @@ if defined serv_e (
set error=1 set error=1
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && ( echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Restart the system to fix this error." call :dk_color %Blue% "Restart your system to fix this error."
set showfix=1 set showfix=1
) )
) )
@ -1385,7 +1386,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]" call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || ( ) || (
echo Checking WPA Registry Count [%wpainfo%] echo Checking WPA Registry Count [%wpainfo%]
) )
@ -1424,7 +1425,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1 set error=1
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]" call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
) )
) )
) )
@ -1495,7 +1496,7 @@ echo Checking Eval WLMS Service [Found]
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]" call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -1520,7 +1521,7 @@ set error=1
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( 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]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1550,9 +1551,9 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;" set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul% %psc% "!d!" %nul%
if exist "%tokenstore%\" ( if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]" call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else ( ) else (
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]" call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1670,7 +1671,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
} }
for ($i=1; $i -le $count; $i++) { for ($i=1; $i -le $count; $i++) {
if (-not $subkeyHashTable.ContainsKey("$i")) { if (-not $subkeyHashTable.ContainsKey("$i")) {
Write-Output "Total Keys $count. Error Found- $i key does not exist" Write-Output "Total Keys $count. Error Found - $i key does not exist."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1681,7 +1682,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
if ($PSVersionTable.PSVersion.Major -lt 3) { if ($PSVersionTable.PSVersion.Major -lt 3) {
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1689,7 +1690,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
$subkey = $wpaKey.OpenSubKey($_) $subkey = $wpaKey.OpenSubKey($_)
$p = $subkey.GetValueNames() $p = $subkey.GetValueNames()
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) { if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1728,13 +1729,13 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."

View File

@ -27,7 +27,7 @@ set "_debug=0"
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -160,15 +160,15 @@ call :dk_setvar
if %winbuild% LSS 9200 ( if %winbuild% LSS 9200 (
%eline% %eline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo Ohook Activation is supported on Windows 8 and later and their server equivalent. echo Ohook Activation is supported only on Windows 8/10/11 and their server equivalents.
echo: echo:
call :dk_color %Blue% "Use Online KMS Activation option." call :dk_color %Blue% "Use Online KMS activation option instead."
goto dk_done goto dk_done
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -188,8 +188,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto dk_done goto dk_done
@ -230,7 +230,7 @@ goto dk_done
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto dk_done goto dk_done
) )
@ -289,14 +289,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -332,7 +332,7 @@ echo:
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo ____________________________________________________________ echo ____________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,3,0]" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,0]"
choice /C:1230 /N choice /C:1230 /N
set _el=!errorlevel! set _el=!errorlevel!
if !_el!==4 exit /b if !_el!==4 exit /b
@ -360,7 +360,7 @@ call :dk_chkmal
if not exist %SysPath%\sppsvc.exe ( if not exist %SysPath%\sppsvc.exe (
%eline% %eline%
echo [%SysPath%\sppsvc.exe] file is missing. Aborting... echo [%SysPath%\sppsvc.exe] file is missing, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -456,10 +456,10 @@ call :dk_color %Red% "Checking Installed Office [Not Found]"
if defined ohub ( if defined ohub (
echo: echo:
echo You have only Office dashboard app installed, you need to install full Office version. echo You only have the Office dashboard app installed, you need to install the full version of Office.
) )
echo: echo:
call :dk_color %Blue% "Download and install Office from below URL and try again." call :dk_color %Blue% "Download and install Office from the below URL and then try again."
echo: echo:
set fixes=%fixes% %mas%genuine-installation-media set fixes=%fixes% %mas%genuine-installation-media
call :dk_color %_Yellow% "%mas%genuine-installation-media" call :dk_color %_Yellow% "%mas%genuine-installation-media"
@ -471,7 +471,7 @@ if not "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="1" set multioffice=1
if not "%o14msi%%o14c2r%%o16uwp%"=="" set multioffice=1 if not "%o14msi%%o14c2r%%o16uwp%"=="" set multioffice=1
if defined multioffice ( if defined multioffice (
call :dk_color %Gray% "Checking Multiple Office Install [Found. Recommended to install one version only]" call :dk_color %Gray% "Checking Multiple Office Install [Found, its recommended to install only one version]"
) )
::======================================================================================================================================== ::========================================================================================================================================
@ -619,7 +619,7 @@ reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" /reg:
) )
reg delete "%kmskey%" /f %nul% reg delete "%kmskey%" /f %nul%
reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" %nul% reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" %nul%
echo Adding a Reg To Prevent Banner [Successful] echo Adding a Registry to Prevent Banner [Successful]
) )
) )
@ -667,7 +667,7 @@ call :oh_reset
call :oh_getpath call :oh_getpath
echo: echo:
echo Uninstalling Ohook Activation... echo Uninstalling Ohook activation...
echo: echo:
if defined o16c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg% /v InstallPath" %nul6%') do (set "_16CHook=%%b\root\vfs")) if defined o16c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg% /v InstallPath" %nul6%') do (set "_16CHook=%%b\root\vfs"))
@ -698,7 +698,7 @@ if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" (set _present=1& del /s /f
reg query HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && ( reg query HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && (
echo: echo:
echo Deleting - Registry keys to skip license check from all ^& future new useraccounts echo Deleting - Registry keys for skipping license check
reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul% reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
reg query HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && reg delete HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f reg query HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && reg delete HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
@ -723,7 +723,7 @@ reg unload HKU\%%# %nul%
set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663"
reg query "%kmskey%" %nul% && ( reg query "%kmskey%" %nul% && (
echo: echo:
echo Deleting - Registry keys to prevent non-genuine banner echo Deleting - Registry keys for preventing non-genuine banner
reg delete "%kmskey%" /f reg delete "%kmskey%" /f
) )
@ -735,16 +735,16 @@ echo ___________________________________________________________________________
echo: echo:
if not defined _present ( if not defined _present (
echo Ohook Activation is not installed. echo Ohook activation is not installed.
) else ( ) else (
if defined _unerror ( if defined _unerror (
call :dk_color %Red% "Failed to uninstall Ohook activation." call :dk_color %Red% "Failed to uninstall Ohook activation."
call :oh_checkapps call :oh_checkapps
if defined checknames ( if defined checknames (
call :dk_color %Blue% "Close [!checknames!] and try again." call :dk_color %Blue% "Close [!checknames!] and try again."
call :dk_color %Blue% "If its still not resolved then restart system and try again." call :dk_color %Blue% "If it is still not fixed, then restart your system and try again."
) else ( ) else (
call :dk_color %Blue% "Restart system and try again." call :dk_color %Blue% "Restart your system and try again."
) )
) else ( ) else (
call :dk_color %Green% "Successfully uninstalled Ohook activation." call :dk_color %Green% "Successfully uninstalled Ohook activation."
@ -919,11 +919,11 @@ if not exist "%_hookPath%\sppc.dll" (if not defined ierror set ierror=Copy)
echo: echo:
if not defined ierror ( if not defined ierror (
echo Symlinking System's sppc.dll To ["%_hookPath%\sppcs.dll"] [Successful] echo Symlinking System's sppc.dll to ["%_hookPath%\sppcs.dll"] [Successful]
if defined exhook ( if defined exhook (
echo Copying Custom %_hook% To ["%_hookPath%\sppc.dll"] [Successful] echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
) else ( ) else (
echo Extracting Custom %_hook% To ["%_hookPath%\sppc.dll"] [Successful] echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
) )
) else ( ) else (
set error=1 set error=1
@ -932,9 +932,9 @@ echo:
call :oh_checkapps call :oh_checkapps
if defined checknames ( if defined checknames (
call :dk_color %Blue% "Close [!checknames!] and try again." call :dk_color %Blue% "Close [!checknames!] and try again."
call :dk_color %Blue% "If its still not resolved then restart system and try again." call :dk_color %Blue% "If it is still not fixed, then restart your system and try again."
) else ( ) else (
if /i not "%ierror%"=="Copy" call :dk_color %Blue% "Restart system and try again." if /i not "%ierror%"=="Copy" call :dk_color %Blue% "Restart your system and try again."
if /i "%ierror%"=="Copy" call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." if /i "%ierror%"=="Copy" call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
) )
echo: echo:
@ -982,7 +982,7 @@ call :dk_inskey "[!key!] [!_prod!] [!_lic!]"
) else ( ) else (
set error=1 set error=1
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
call :dk_color %Blue% "Make sure you are using Latest MAS script." call :dk_color %Blue% "Make sure you are using the latest version of MAS."
set fixes=%fixes% %mas% set fixes=%fixes% %mas%
call :dk_color %_Yellow% "%mas%" call :dk_color %_Yellow% "%mas%"
) )
@ -996,7 +996,7 @@ if defined winserver if defined _config (
echo %_oIds% | find /i "Retail" %nul1% && ( echo %_oIds% | find /i "Retail" %nul1% && (
set scaIsNeeded=1 set scaIsNeeded=1
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
echo Adding SharedComputerLicensing Reg [Successful] [Needed On Server With Retail Office]" echo Adding SharedComputerLicensing Reg [Successful] [Needed on Server With Retail Office]"
) )
) )
@ -1043,13 +1043,13 @@ echo Activating Office... [MSI ^| %_version% ^| %_oArch%]
if not defined _oBranding ( if not defined _oBranding (
set error=1 set error=1
call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]"
exit /b exit /b
) )
if not defined _oIds ( if not defined _oIds (
set error=1 set error=1
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]"
exit /b exit /b
) )
@ -1190,7 +1190,7 @@ reg delete "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwarePr
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul% reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul% reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul%
echo Clearing Office License Blocks [Successfully Cleared From All %counter% Useraccounts] echo Clearing Office License Blocks [Successfully cleared from all %counter% user accounts]
::========================== ::==========================
@ -1208,7 +1208,7 @@ for %%# in (%_sidlist%) do (
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul% reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul% reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
) )
echo Adding Reg Keys To Skip License Check [Successfully Added To All %counter% ^& Future New Useraccounts] echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
) )
::========================== ::==========================
@ -1222,14 +1222,14 @@ reg query HKU\%%# %nul% && set failedtounload=1
if defined failedtoload ( if defined failedtoload (
set error=1 set error=1
call :dk_color %Red% "Loading Unloaded accounts Registry [Failed For Some Useraccounts]" call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
call :dk_color %Blue% "Restart the system and try again." call :dk_color %Blue% "Restart your system and try again."
) )
if defined failedtounload ( if defined failedtounload (
set error=1 set error=1
call :dk_color %Red% "Unloading loaded accounts Registry [Failed For Some Useraccounts]" call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
call :dk_color %Blue% "Restart the system and try again." call :dk_color %Blue% "Restart your system and try again."
) )
exit /b exit /b
@ -1524,7 +1524,7 @@ set pupfound=%pupfound1%%pupfound2%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[AV URLs are blocked in hosts]" if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0 set wucount=0
for %%# in (wuauserv) do ( for %%# in (wuauserv) do (
@ -1533,7 +1533,7 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1) reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
) )
) )
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
@ -1544,7 +1544,8 @@ if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@ -1563,7 +1564,7 @@ call :dk_chkmal
sc query Null %nul% || ( sc query Null %nul% || (
set error=1 set error=1
set showfix=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.]"
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo: echo:
) )
@ -1654,7 +1655,7 @@ if defined serv_e (
set error=1 set error=1
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && ( echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Restart the system to fix this error." call :dk_color %Blue% "Restart your system to fix this error."
set showfix=1 set showfix=1
) )
) )
@ -1694,7 +1695,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]" call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || ( ) || (
echo Checking WPA Registry Count [%wpainfo%] echo Checking WPA Registry Count [%wpainfo%]
) )
@ -1733,7 +1734,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1 set error=1
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]" call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
) )
) )
) )
@ -1804,7 +1805,7 @@ echo Checking Eval WLMS Service [Found]
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]" call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -1829,7 +1830,7 @@ set error=1
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( 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]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1859,9 +1860,9 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;" set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul% %psc% "!d!" %nul%
if exist "%tokenstore%\" ( if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]" call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else ( ) else (
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]" call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1979,7 +1980,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
} }
for ($i=1; $i -le $count; $i++) { for ($i=1; $i -le $count; $i++) {
if (-not $subkeyHashTable.ContainsKey("$i")) { if (-not $subkeyHashTable.ContainsKey("$i")) {
Write-Output "Total Keys $count. Error Found- $i key does not exist" Write-Output "Total Keys $count. Error Found - $i key does not exist."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1990,7 +1991,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
if ($PSVersionTable.PSVersion.Major -lt 3) { if ($PSVersionTable.PSVersion.Major -lt 3) {
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -1998,7 +1999,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
$subkey = $wpaKey.OpenSubKey($_) $subkey = $wpaKey.OpenSubKey($_)
$p = $subkey.GetValueNames() $p = $subkey.GetValueNames()
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) { if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -2037,13 +2038,13 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."

View File

@ -52,7 +52,7 @@ set "_debug=0"
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -191,13 +191,13 @@ call :dk_setvar
if %winbuild% LSS 7600 ( if %winbuild% LSS 7600 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo Project is supported for Windows 7/8/8.1/10/11 and their Server equivalent. echo MAS only supports Windows 7/8/8.1/10/11 and their Server equivalents.
goto dk_done goto dk_done
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -217,8 +217,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto dk_done goto dk_done
@ -259,7 +259,7 @@ goto dk_done
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto dk_done goto dk_done
) )
@ -318,14 +318,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -385,7 +385,7 @@ echo [9] Download Office
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,3,4,5,6,7,8,9,0]" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,5,6,7,8,9,0]"
choice /C:1234567890 /N choice /C:1234567890 /N
set _el=!errorlevel! set _el=!errorlevel!
@ -420,7 +420,7 @@ call :dk_chkmal
if not exist %SysPath%\sppsvc.exe ( if not exist %SysPath%\sppsvc.exe (
%eline% %eline%
echo [%SysPath%\sppsvc.exe] file is missing. Aborting... echo [%SysPath%\sppsvc.exe] file is missing, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -508,7 +508,7 @@ if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*EvalCorEditio
if defined _eval ( if defined _eval (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% && (
call :dk_color %Red% "Checking Eval Edition [Evaluation Editions cannot be activated outside of evaluation period.]" call :dk_color %Red% "Checking Evaluation Edition [Evaluation editions cannot be activated outside of evaluation period.]"
if defined _evalserv ( if defined _evalserv (
call :dk_color %Blue% "Go back to main menu and use [Change Edition] option." call :dk_color %Blue% "Go back to main menu and use [Change Edition] option."
@ -546,7 +546,7 @@ set /a UBR=0
if %osSKU%==191 if defined altkey if defined altedition ( if %osSKU%==191 if defined altkey if defined altedition (
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
if %winbuild% LSS 22598 if !UBR! LSS 2788 ( if %winbuild% LSS 22598 if !UBR! LSS 2788 (
call :dk_color %Blue% "Windows must to be updated to build 19044.2788 or higher for IotEnterpriseS %KS% activation." call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for IotEnterpriseS %KS% activation."
) )
) )
@ -557,11 +557,11 @@ call :dk_color %Red% "Checking Alternate Edition For %KS% [%altedition% Act
if not defined key if not defined _gvlk ( if not defined key if not defined _gvlk (
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound ( if not defined skunotfound (
echo This product does not support %KS% Activation. echo This product does not support %KS% activation.
set fixes=%fixes% %mas%unsupported_products_activation set fixes=%fixes% %mas%unsupported_products_activation
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation"
) else ( ) else (
echo Required License files not found in %SysPath%\spp\tokens\skus\ echo Required license files not found in %SysPath%\spp\tokens\skus\
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -574,7 +574,7 @@ goto :ks_office
:: Install key :: Install key
if defined changekey ( if defined changekey (
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable %KS% activation." call :dk_color %Blue% "[%altedition%] edition product key will be used to enable %KS% activation."
echo: echo:
) )
@ -1291,7 +1291,7 @@ reg delete "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwarePr
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul% reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul% reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul%
echo Clearing Office License Blocks [Successfully Cleared From All %counter% Useraccounts] echo Clearing Office License Blocks [Successfully cleared from all %counter% user accounts]
::========================== ::==========================
@ -1309,7 +1309,7 @@ for %%# in (%_sidlist%) do (
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul% reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul% reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
) )
echo Adding Reg Keys To Skip License Check [Successfully Added To All %counter% ^& Future New Useraccounts] echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
) )
::========================== ::==========================
@ -1323,14 +1323,14 @@ reg query HKU\%%# %nul% && set failedtounload=1
if defined failedtoload ( if defined failedtoload (
set error=1 set error=1
call :dk_color %Red% "Loading Unloaded accounts Registry [Failed For Some Useraccounts]" call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
call :dk_color %Blue% "Restart the system and try again." call :dk_color %Blue% "Restart your system and try again."
) )
if defined failedtounload ( if defined failedtounload (
set error=1 set error=1
call :dk_color %Red% "Unloading loaded accounts Registry [Failed For Some Useraccounts]" call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
call :dk_color %Blue% "Restart the system and try again." call :dk_color %Blue% "Restart your system and try again."
) )
exit /b exit /b
@ -2573,7 +2573,7 @@ set pupfound=%pupfound1%%pupfound2%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[AV URLs are blocked in hosts]" if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0 set wucount=0
for %%# in (wuauserv) do ( for %%# in (wuauserv) do (
@ -2582,7 +2582,7 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1) reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
) )
) )
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
@ -2593,7 +2593,8 @@ if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@ -2612,7 +2613,7 @@ call :dk_chkmal
sc query Null %nul% || ( sc query Null %nul% || (
set error=1 set error=1
set showfix=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.]"
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo: echo:
) )
@ -2703,7 +2704,7 @@ if defined serv_e (
set error=1 set error=1
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && ( echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Restart the system to fix this error." call :dk_color %Blue% "Restart your system to fix this error."
set showfix=1 set showfix=1
) )
) )
@ -2743,7 +2744,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]" call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || ( ) || (
echo Checking WPA Registry Count [%wpainfo%] echo Checking WPA Registry Count [%wpainfo%]
) )
@ -2782,7 +2783,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1 set error=1
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]" call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
) )
) )
) )
@ -2853,7 +2854,7 @@ echo Checking Eval WLMS Service [Found]
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]" call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -2878,7 +2879,7 @@ set error=1
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( 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]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -2908,9 +2909,9 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;" set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul% %psc% "!d!" %nul%
if exist "%tokenstore%\" ( if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]" call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else ( ) else (
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]" call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -3028,7 +3029,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
} }
for ($i=1; $i -le $count; $i++) { for ($i=1; $i -le $count; $i++) {
if (-not $subkeyHashTable.ContainsKey("$i")) { if (-not $subkeyHashTable.ContainsKey("$i")) {
Write-Output "Total Keys $count. Error Found- $i key does not exist" Write-Output "Total Keys $count. Error Found - $i key does not exist."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -3039,7 +3040,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
if ($PSVersionTable.PSVersion.Major -lt 3) { if ($PSVersionTable.PSVersion.Major -lt 3) {
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -3047,7 +3048,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
$subkey = $wpaKey.OpenSubKey($_) $subkey = $wpaKey.OpenSubKey($_)
$p = $subkey.GetValueNames() $p = $subkey.GetValueNames()
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) { if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt" Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
$wpaKey.Close() $wpaKey.Close()
exit exit
} }
@ -3086,13 +3087,13 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."

View File

@ -19,7 +19,7 @@ set _stg=0
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -127,13 +127,13 @@ set "line=echo _________________________________________________________________
if %winbuild% LSS 7600 ( if %winbuild% LSS 7600 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent. echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
goto dk_done goto dk_done
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -153,8 +153,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto dk_done goto dk_done
@ -195,7 +195,7 @@ goto dk_done
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto dk_done goto dk_done
) )
@ -254,14 +254,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -280,7 +280,7 @@ if not defined desktop for /f "delims=" %%a in ('%psc% "& {write-host $([Environ
if not defined desktop ( if not defined desktop (
%eline% %eline%
echo Desktop location was not detected, aborting... echo Unable to detect Desktop location, aborting...
goto dk_done goto dk_done
) )
@ -302,7 +302,7 @@ dism.exe
) do ( ) do (
if not exist %SysPath%\%%# ( if not exist %SysPath%\%%# (
%eline% %eline%
echo [%SysPath%\%%#] file is missing. Aborting... echo [%SysPath%\%%#] file is missing, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -335,7 +335,7 @@ if defined UBR (set "fullbuild=%%G.!UBR!") else (set "fullbuild=%%G.%%H")
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%eline% %eline%
echo Either key is not insalled or failed to get installed key activation ID. Aborting... echo Either key is not insalled or script failed to get installed key's activation ID. Aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -356,7 +356,7 @@ if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
if %osedition%==0 ( if %osedition%==0 (
%eline% %eline%
echo Failed to detect OS Edition. Aborting... echo Failed to detect OS edition, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -376,7 +376,7 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
::======================================================================================================================================== ::========================================================================================================================================
:: Get Target editions list :: Get target editions list
set _target= set _target=
set _dtarget= set _dtarget=
@ -403,9 +403,9 @@ call :dk_color %Red% "==== Note ===="
echo: echo:
echo [EditionID:%osedition% ^| %fullbuild%] echo [EditionID:%osedition% ^| %fullbuild%]
echo: echo:
echo Changing this edition to any other may not remove "%osedition%" specific features. echo Changing this edition may not remove "%osedition%"-specific features.
echo: echo:
call :dk_color %_Yellow% "Press 7 key to continue..." call :dk_color %_Yellow% "Press [7] to continue anyway..."
choice /c 7 /n choice /c 7 /n
cls cls
) )
@ -424,7 +424,7 @@ if not defined _ntarget (
%line% %line%
echo: echo:
if defined dismnotworking call :dk_color %Red% "DISM.exe is not working." if defined dismnotworking call :dk_color %Red% "DISM.exe is not working."
call :dk_color %Gray% "Target Edition not found." call :dk_color %Gray% "Target editions not found."
echo Current Edition [%osedition% ^| %winbuild%] can not be changed to any other Edition. echo Current Edition [%osedition% ^| %winbuild%] can not be changed to any other Edition.
%line% %line%
goto dk_done goto dk_done
@ -443,7 +443,7 @@ set targetedition=
%line% %line%
echo: echo:
call :dk_color %Gray% "You can change the Edition [%osedition%] [%fullbuild%] to one of the following." call :dk_color %Gray% "You can change the edition [%osedition%] [%fullbuild%] to one of the following."
%showeditionerror% %showeditionerror%
if defined dismnotworking ( if defined dismnotworking (
call :dk_color %_Yellow% "Note - DISM.exe is not working." call :dk_color %_Yellow% "Note - DISM.exe is not working."
@ -462,7 +462,7 @@ set targetedition!counter!=%%A
echo: echo:
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo: echo:
call :dk_color %_Green% "Enter option number in keyboard, and press "Enter":" call :dk_color %_Green% "Enter an option number using your keyboard and press Enter to confirm:"
set /p inpt= set /p inpt=
if "%inpt%"=="" goto cedmenu2 if "%inpt%"=="" goto cedmenu2
if "%inpt%"=="0" exit /b if "%inpt%"=="0" exit /b
@ -483,12 +483,12 @@ echo:
call :dk_color %Red% "==== Note ====" call :dk_color %Red% "==== Note ===="
echo: echo:
echo Once the edition is changed to "%targetedition%", echo Once the edition is changed to "%targetedition%",
echo system may not be able to properly change edition to any other later. echo the system may not be able to properly change edition later.
echo: echo:
echo [1] Continue echo [1] Continue Anyway
echo [0] Go Back echo [0] Go Back
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 goto cedmenu2 if !errorlevel!==2 goto cedmenu2
if !errorlevel!==1 rem if !errorlevel!==1 rem
@ -499,7 +499,7 @@ set key=
set _chan= set _chan=
set _dismapi=0 set _dismapi=0
:: Check if DISM Api or slmgr.vbs is required for edition upgrade :: Check if DISM API or slmgr.vbs is required for edition upgrade
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" ( if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" (
echo %_wtarget% | find /i " %targetedition% " || ( echo %_wtarget% | find /i " %targetedition% " || (
@ -521,7 +521,7 @@ set _chan=Retail
if not defined key ( if not defined key (
%eline% %eline%
echo [%targetedition% ^| %winbuild%] echo [%targetedition% ^| %winbuild%]
echo Unable to get product key from pkeyhelper.dll echo Failed to get product key from pkeyhelper.dll.
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -544,13 +544,13 @@ cls
echo: echo:
%showeditionerror% %showeditionerror%
if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not working." if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not working."
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%] echo Changing the current edition [%osedition%] %fullbuild% to [%targetedition%]...
echo: echo:
if %_dismapi%==1 ( if %_dismapi%==1 (
call :dk_color %Green% "Notes-" call :dk_color %Green% "Notes -"
echo: echo:
echo - Save your work before continue, system will auto restart. echo - Save your work before continuing, the system will auto-restart.
echo: echo:
echo - You will need to activate with HWID option once the edition is changed. echo - You will need to activate with HWID option once the edition is changed.
%line% %line%
@ -562,7 +562,7 @@ if !errorlevel!==1 exit /b
::======================================================================================================================================== ::========================================================================================================================================
if %_dismapi%==0 ( if %_dismapi%==0 (
echo Installing %_chan% Key [%key%] echo Installing %_chan% key [%key%]
echo: echo:
if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul% if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul%
if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
@ -574,7 +574,7 @@ if !keyerror! EQU 0 (
call :dk_refresh call :dk_refresh
call :dk_color %Green% "[Successful]" call :dk_color %Green% "[Successful]"
echo: echo:
call :dk_color %Gray% "Reboot is required to properly change the Edition." call :dk_color %Gray% "Reboot is required to fully change the edition."
) else ( ) else (
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]" call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
echo: echo:
@ -585,7 +585,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
if %_dismapi%==1 ( if %_dismapi%==1 (
echo: echo:
echo Applying the DISM API method with %_chan% Key %key%. Please wait... echo Applying the DISM API method with %_chan% key %key%. Please wait...
echo: echo:
call :ced_prep call :ced_prep
@ -614,9 +614,9 @@ if defined rebootreq goto dk_done
echo: echo:
%showeditionerror% %showeditionerror%
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working." if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%] echo Changing the current edition [%osedition%] %fullbuild% to [%targetedition%]...
echo: echo:
call :dk_color %Blue% "Important - Save your work before continue, system will auto reboot." call :dk_color %Blue% "Important - Save your work before continuing, the system will auto-restart."
echo: echo:
choice /C:01 /N /M "[1] Continue [0] %_exitmsg% : " choice /C:01 /N /M "[1] Continue [0] %_exitmsg% : "
if %errorlevel%==1 exit /b if %errorlevel%==1 exit /b
@ -657,7 +657,7 @@ if not defined key call :changeeditiondata
if not defined key ( if not defined key (
%eline% %eline%
echo [%targetedition% ^| %winbuild%] echo [%targetedition% ^| %winbuild%]
echo Unable to get product key from pkeyhelper.dll echo Failed to get product key from pkeyhelper.dll.
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -671,13 +671,13 @@ cls
echo: echo:
%showeditionerror% %showeditionerror%
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working." if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%] echo Changing the current edition [%osedition%] %fullbuild% to [%targetedition%]...
echo: echo:
call :ced_prep call :ced_prep
if defined preperror goto dk_done if defined preperror goto dk_done
echo Applying the command with %_chan% Key echo Applying the command with %_chan% key...
echo DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula echo DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
@ -699,8 +699,8 @@ for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time
sc query TrustedInstaller | find /i "RUNNING" %nul% && ( sc query TrustedInstaller | find /i "RUNNING" %nul% && (
%eline% %eline%
echo Failed to stop TrustedInstaller service. echo Failed to stop the TrustedInstaller service.
echo Try again or Restart your system and then try again. echo Restart your system and try again.
set preperror=1 set preperror=1
exit /b exit /b
) )
@ -731,9 +731,9 @@ call :compresslog DISM\dism_%_time%.log ChangeEdition_Logs\DISM %nul%
echo: echo:
if %winbuild% GEQ 9200 %psc% "if ((Get-WindowsOptionalFeature -Online -FeatureName NetFx3).State -eq 'Enabled') {Write-Host 'Checking .NET Framework 3.5 Status - Enabled'}" if %winbuild% GEQ 9200 %psc% "if ((Get-WindowsOptionalFeature -Online -FeatureName NetFx3).State -eq 'Enabled') {Write-Host 'Checking .NET Framework 3.5 Status - Enabled'}"
echo Log files are copied to the ChangeEdition_Logs folder on the desktop. echo Log files are copied to the ChangeEdition_Logs folder on your desktop.
echo: echo:
call :dk_color %Blue% "In case of errors, restart system before trying again." call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
echo: echo:
set fixes=%fixes% %mas%change_edition_issues set fixes=%fixes% %mas%change_edition_issues
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
@ -891,7 +891,7 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Upd
if defined rebootreq ( if defined rebootreq (
%eline% %eline%
echo Pending Reboot flags found. echo Pending reboot flags found.
echo: echo:
echo Make sure Windows is fully updated, restart the system and try again. echo Make sure Windows is fully updated, restart the system and try again.
) )
@ -987,13 +987,13 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."

View File

@ -14,7 +14,7 @@
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -121,13 +121,13 @@ call :dk_setvar
if %winbuild% LSS 7600 ( if %winbuild% LSS 7600 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent. echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
goto done2 goto done2
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -147,8 +147,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto done2 goto done2
@ -189,7 +189,7 @@ goto done2
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto done2 goto done2
) )
@ -248,14 +248,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -277,7 +277,7 @@ set "_dir=%desktop%\$OEM$\$$\Setup\Scripts"
if exist "!desktop!\" ( if exist "!desktop!\" (
%eline% %eline%
echo Desktop location was not detected, aborting... echo Unable to detect Desktop location, aborting...
goto done2 goto done2
) )
@ -290,7 +290,7 @@ if not defined terminal mode 78, 30
if exist "!desktop!\$OEM$\" ( if exist "!desktop!\$OEM$\" (
echo _____________________________________________________ echo _____________________________________________________
%eline% %eline%
echo $OEM$ folder already exists on the Desktop. echo The $OEM$ folder already exists on your Desktop.
echo _____________________________________________________ echo _____________________________________________________
goto done2 goto done2
) )
@ -349,7 +349,7 @@ call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
echo: [0] Exit echo: [0] Exit
echo: ________________________________________________________ echo: ________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard :" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
choice /C:123456789R0 /N choice /C:123456789R0 /N
set _erl=%errorlevel% set _erl=%errorlevel%
@ -681,7 +681,7 @@ cd \
:errorfound :errorfound
%eline% %eline%
echo $OEM$ Folder was not created successfully... echo The script failed to create the $OEM$ folder.
goto :done2 goto :done2
:done :done
@ -689,7 +689,7 @@ goto :done2
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color %Blue% "%oem%" call :dk_color %Blue% "%oem%"
call :dk_color %Green% "$OEM$ folder is successfully created on the Desktop." call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
echo "%oem%" | find /i "38" %nul% && ( echo "%oem%" | find /i "38" %nul% && (
echo: echo:
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^), echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
@ -701,13 +701,13 @@ echo ______________________________________________________________
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."

View File

@ -14,7 +14,7 @@
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set environment variables, it helps if they are misconfigured in the system
setlocal EnableExtensions setlocal EnableExtensions
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
@ -122,13 +122,13 @@ set "line=______________________________________________________________________
if %winbuild% LSS 7600 ( if %winbuild% LSS 7600 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent. echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
goto dk_done goto dk_done
) )
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special character limitations in path name
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -148,8 +148,8 @@ setlocal EnableDelayedExpansion
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo Script is launched from the temp folder, echo The script was launched from the temp folder.
echo Most likely you are running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto dk_done goto dk_done
@ -190,7 +190,7 @@ goto dk_done
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo Right click on this script and select 'Run as administrator'.
goto dk_done goto dk_done
) )
@ -249,14 +249,14 @@ if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo Your version of MAS [%masver%] is outdated.
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 ( if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
@ -275,7 +275,7 @@ if not defined desktop for /f "delims=" %%a in ('%psc% "& {write-host $([Environ
if not defined desktop ( if not defined desktop (
%eline% %eline%
echo Desktop location was not detected, aborting... echo Unable to detect Desktop location, aborting...
goto dk_done goto dk_done
) )
@ -310,7 +310,7 @@ echo:
echo: [0] %_exitmsg% echo: [0] %_exitmsg%
echo: _______________________________________________________________ echo: _______________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard :" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
choice /C:1234560 /N choice /C:1234560 /N
set _erl=%errorlevel% set _erl=%errorlevel%
@ -333,8 +333,8 @@ title Dism /English /Online /Cleanup-Image /RestoreHealth
if %winbuild% LSS 9200 ( if %winbuild% LSS 9200 (
%eline% %eline%
echo Unsupported OS version Detected. echo Unsupported OS version detected.
echo This command is supported only for Windows 8/8.1/10/11 and their Server equivalent. echo This command only works on Windows 8/8.1/10/11 and their Server equivalents.
goto :at_back goto :at_back
) )
@ -352,14 +352,14 @@ call :dk_color2 %_White% " " %Red% "Checking Internet Connection [Not conne
echo %line% echo %line%
echo: echo:
echo Dism uses Windows Update to provide the files required to fix corruption. echo DISM uses Windows Update to provide replacement files required to fix corruption.
echo This will take 5-15 minutes or more.. echo This will take 5-15 minutes or more..
echo %line% echo %line%
echo: echo:
echo Notes: echo Notes:
echo: echo:
call :dk_color2 %_White% " - " %Gray% "Make sure the Internet is connected." call :dk_color2 %_White% " - " %Gray% "Make sure the internet is connected."
call :dk_color2 %_White% " - " %Gray% "Make sure the Windows update is properly working." call :dk_color2 %_White% " - " %Gray% "Make sure that Windows update is properly working."
echo: echo:
echo %line% echo %line%
echo: echo:
@ -379,7 +379,7 @@ del /f /q "%SystemRoot%\logs\cbs\cbs.log" %nul%
del /f /q "%SystemRoot%\logs\DISM\dism.log" %nul% del /f /q "%SystemRoot%\logs\DISM\dism.log" %nul%
echo: echo:
echo Applying the command, echo Applying the command...
echo dism /english /online /cleanup-image /restorehealth echo dism /english /online /cleanup-image /restorehealth
dism /english /online /cleanup-image /restorehealth dism /english /online /cleanup-image /restorehealth
@ -400,7 +400,7 @@ copy /y /b "%SystemRoot%\logs\DISM\dism.log" "!desktop!\AT_Logs\RHealth_DISM_%_t
) )
echo: echo:
call :dk_color %Gray% "CBS and DISM logs are copied to the AT_Logs folder on the desktop." call :dk_color %Gray% "CBS and DISM logs are copied to the AT_Logs folder on your desktop."
goto :at_back goto :at_back
::======================================================================================================================================== ::========================================================================================================================================
@ -414,7 +414,8 @@ title sfc /scannow
echo: echo:
echo %line% echo %line%
echo: echo:
echo System File Checker will repair missing or corrupted system files. echo SFC will repair missing or corrupted system files.
echo It is recommended you run the DISM option first before this one.
echo This will take 10-15 minutes or more.. echo This will take 10-15 minutes or more..
echo: echo:
echo If SFC could not fix something, then run the command again to see if it may be able echo If SFC could not fix something, then run the command again to see if it may be able
@ -435,7 +436,7 @@ copy /y /b "%SystemRoot%\logs\cbs\cbs.log" "%SystemRoot%\logs\cbs\backup_cbs_%_t
del /f /q "%SystemRoot%\logs\cbs\cbs.log" %nul% del /f /q "%SystemRoot%\logs\cbs\cbs.log" %nul%
echo: echo:
echo Applying the command, echo Applying the command...
echo sfc /scannow echo sfc /scannow
sfc /scannow sfc /scannow
@ -450,7 +451,7 @@ copy /y /b "%SystemRoot%\logs\cbs\cbs.log" "!desktop!\AT_Logs\SFC_CBS_%_time%.lo
) )
echo: echo:
call :dk_color %Gray% "CBS log is copied to the AT_Logs folder on the desktop." call :dk_color %Gray% "The CBS log was copied to the AT_Logs folder on your Desktop."
goto :at_back goto :at_back
::======================================================================================================================================== ::========================================================================================================================================
@ -469,17 +470,17 @@ echo %line%
echo: echo:
echo Notes: echo Notes:
echo: echo:
echo - It helps in troubleshooting activation issues. echo - This option helps in troubleshooting activation issues.
echo: echo:
echo - This option will, echo - This option will:
echo - Deactivate Windows and Office, you may need to reactivate echo - Deactivate Windows and Office, you may need to reactivate.
echo If Windows is activated with motherboard / OEM / Digital license then don't worry echo If Windows is activated with motherboard / OEM / Digital license then Windows will activate itself again.
echo: echo:
echo - Clear ClipSVC, SPP and OSPP licenses echo - Clear ClipSVC, SPP and OSPP licenses.
echo - Fix SPP permissions of tokens folder and registries echo - Fix permissions of SPP tokens folder and registries.
echo - Trigger the repair option for Office. echo - Trigger the repair option for Office.
echo: echo:
call :dk_color2 %_White% " - " %Red% "Apply it only when it is necessary." call :dk_color2 %_White% " - " %Red% "Apply this option only when it is necessary."
echo: echo:
echo %line% echo %line%
echo: echo:
@ -496,11 +497,11 @@ cls
echo: echo:
echo %line% echo %line%
echo: echo:
call :dk_color %Blue% "Rebuilding ClipSVC Licences" call :dk_color %Blue% "Rebuilding ClipSVC Licenses..."
echo: echo:
if %winbuild% LSS 10240 ( if %winbuild% LSS 10240 (
echo ClipSVC Licence rebuilding is supported only on Win 10/11 and Server equivalent. echo ClipSVC license rebuilding is supported only on Windows 10/11 and their Server equivalents.
echo Skipping... echo Skipping...
goto :rebuildspptok goto :rebuildspptok
) )
@ -516,7 +517,7 @@ echo Stopping ClipSVC service...
timeout /t 2 %nul% timeout /t 2 %nul%
echo: echo:
echo Applying the command to Clean ClipSVC Licences... echo Applying the command to clean ClipSVC Licenses...
echo rundll32 clipc.dll,ClipCleanUpState echo rundll32 clipc.dll,ClipCleanUpState
rundll32 clipc.dll,ClipCleanUpState rundll32 clipc.dll,ClipCleanUpState
@ -545,15 +546,15 @@ echo Deleting a Volatile ^& Protected Registry Key...
echo [%RegKey%] echo [%RegKey%]
reg query "%RegKey%" %nul% && ( reg query "%RegKey%" %nul% && (
call :dk_color %Red% "[Failed]" call :dk_color %Red% "[Failed]"
echo Restart the system, that will delete this registry key automatically. echo Restart your system, that will delete this registry key automatically.
) || ( ) || (
echo [Successful] echo [Successful]
) )
:: Clear HWID token related registry to fix activation incase if there is any corruption :: Clear HWID token related registry to fix activation incase there is any corruption
echo: echo:
echo Deleting a IdentityCRL Registry Key... echo Deleting IdentityCRL Registry Key...
echo [%_ident%] echo [%_ident%]
reg delete "%_ident%" /f %nul% reg delete "%_ident%" /f %nul%
reg query "%_ident%" %nul% && ( reg query "%_ident%" %nul% && (
@ -568,7 +569,7 @@ echo [Successful]
echo: echo:
if %winbuild% GTR 10240 ( if %winbuild% GTR 10240 (
echo Deleting Folder %ProgramData%\Microsoft\Windows\ClipSVC\ echo Deleting folder %ProgramData%\Microsoft\Windows\ClipSVC\
rmdir /s /q "C:\ProgramData\Microsoft\Windows\ClipSvc" %nul% rmdir /s /q "C:\ProgramData\Microsoft\Windows\ClipSvc" %nul%
if exist "%ProgramData%\Microsoft\Windows\ClipSVC\" ( if exist "%ProgramData%\Microsoft\Windows\ClipSVC\" (
@ -578,7 +579,7 @@ echo [Successful]
) )
echo: echo:
echo Rebuilding Folder %ProgramData%\Microsoft\Windows\ClipSVC\ echo Rebuilding the %ProgramData%\Microsoft\Windows\ClipSVC\ folder...
%psc% Start-Service ClipSVC %nul% %psc% Start-Service ClipSVC %nul%
timeout /t 3 %nul% timeout /t 3 %nul%
if not exist "%ProgramData%\Microsoft\Windows\ClipSVC\" timeout /t 5 %nul% if not exist "%ProgramData%\Microsoft\Windows\ClipSVC\" timeout /t 5 %nul%
@ -590,7 +591,7 @@ echo [Successful]
) )
echo: echo:
echo Restarting [wlidsvc LicenseManager] services... echo Restarting wlidsvc ^& LicenseManager services...
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null") for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
::======================================================================================================================================== ::========================================================================================================================================
@ -602,7 +603,7 @@ for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# }
echo: echo:
echo %line% echo %line%
echo: echo:
call :dk_color %Blue% "Rebuilding SPP Licensing Tokens" call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
echo: echo:
call :scandat check call :scandat check
@ -684,7 +685,7 @@ echo:
) )
echo: echo:
echo Reinstalling System Licenses... echo Reinstalling system licenses...
%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
if %errorlevel% EQU 0 ( if %errorlevel% EQU 0 (
@ -697,7 +698,7 @@ call :scandat check
echo: echo:
if not defined token ( if not defined token (
call :dk_color %Red% "Failed to rebuilt tokens.dat file." call :dk_color %Red% "Failed to rebuild tokens.dat file."
) else ( ) else (
echo tokens.dat file was rebuilt successfully. echo tokens.dat file was rebuilt successfully.
) )
@ -713,11 +714,11 @@ sc config sppuinotify start= demand
echo: echo:
echo %line% echo %line%
echo: echo:
call :dk_color %Blue% "Rebuilding OSPP Licensing Tokens" call :dk_color %Blue% "Rebuilding OSPP licensing tokens..."
echo: echo:
sc qc osppsvc %nul% || ( sc qc osppsvc %nul% || (
echo OSPP based Office is not installed echo OSPP-based Office is not installed.
echo Skipping rebuilding OSPP tokens... echo Skipping rebuilding OSPP tokens...
goto :repairoffice goto :repairoffice
) )
@ -745,7 +746,7 @@ echo:
) )
echo: echo:
echo Starting osppsvc service to generate tokens.dat echo Starting osppsvc service to generate tokens.dat...
%psc% Start-Service osppsvc %nul% %psc% Start-Service osppsvc %nul%
call :scandatospp check call :scandatospp check
if not defined token ( if not defined token (
@ -758,7 +759,7 @@ call :scandatospp check
echo: echo:
if not defined token ( if not defined token (
call :dk_color %Red% "Failed to rebuilt tokens.dat file." call :dk_color %Red% "Failed to rebuild tokens.dat file."
) else ( ) else (
echo tokens.dat file was rebuilt successfully. echo tokens.dat file was rebuilt successfully.
) )
@ -770,7 +771,7 @@ echo tokens.dat file was rebuilt successfully.
echo: echo:
echo %line% echo %line%
echo: echo:
call :dk_color %Blue% "Repairing Office Licenses" call :dk_color %Blue% "Repairing Office licenses..."
echo: echo:
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b
@ -837,8 +838,8 @@ set /a counter+=1
if %counter% GTR 1 ( if %counter% GTR 1 (
%eline% %eline%
echo Multiple office versions found. echo Multiple Office versions found.
echo It's recommended to install only one version of office. echo It is recommended to only install one version of Office.
echo ________________________________________________________________ echo ________________________________________________________________
echo: echo:
) )
@ -850,9 +851,9 @@ goto :repairend
echo: echo:
) else ( ) else (
echo: echo:
call :dk_color %_Yellow% "A Window will popup, in that Window you need to select [Quick] Repair Option..." call :dk_color %_Yellow% "A new window will appear, in that window you need to select [Quick Repair] option."
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to continue..." call :dk_color %_Yellow% "Press [0] to continue..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to continue..." call :dk_color %_Yellow% "Press any key to continue..."
@ -862,8 +863,8 @@ pause %nul1%
if defined uwp16 ( if defined uwp16 (
echo: echo:
echo Note: Skipping repair for Office 16.0 UWP. echo Note: Skipping repair for Office 16.0 UWP...
echo You need to use reset option in Windows settings for it. echo You need to use the Reset option in Windows Settings instead.
echo ________________________________________________________________ echo ________________________________________________________________
echo: echo:
start ms-settings:appsfeatures start ms-settings:appsfeatures
@ -875,8 +876,8 @@ if defined c2r14_86 set c2r14=1
if defined c2r14 ( if defined c2r14 (
echo: echo:
echo Note: Skipping repair for Office 14.0 C2R echo Note: Skipping repair for Office 14.0 C2R...
echo You need to use Repair option in Windows settings for it. echo You need to use the Repair option in Windows Settings for it.
echo ________________________________________________________________ echo ________________________________________________________________
echo: echo:
start appwiz.cpl start appwiz.cpl
@ -923,7 +924,7 @@ title Fix WMI
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
%eline% %eline%
echo WMI rebuild is not recommended on Windows Server. Aborting... echo Rebuilding WMI is not recommended on Windows Server, aborting...
goto :at_back goto :at_back
) )
@ -941,7 +942,7 @@ call :checkwmi
if not defined error ( if not defined error (
echo [Working] echo [Working]
echo No need to apply this option. Aborting... echo No need to apply this option, aborting...
goto :at_back goto :at_back
) )
@ -956,7 +957,7 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
echo: echo:
if defined _corrupt ( if defined _corrupt (
%eline% %eline%
echo Winmgmt service is corrupted. Aborting... echo Winmgmt service is corrupted, aborting...
goto :at_back goto :at_back
) )
@ -1078,7 +1079,7 @@ echo:
echo %line% echo %line%
echo: echo:
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
@ -1122,7 +1123,7 @@ exit /b
:checkperms :checkperms
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers. :: This code checks if SPP has permission access to tokens folder and required registry keys. Incorrect permissions are often set by gaming spoofers.
set permerror= set permerror=
if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder" if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder"
@ -1370,13 +1371,13 @@ $key.SetAccessControl($acl)
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore" call :dk_color2 %Blue% "Press [1] to open Troubleshoot page " %Gray% " Press [0] to ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..." call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n choice /c 0 /n
) else ( ) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."