:: Check if Null service is working, it's important for the batch script
sc query Null | find /i "RUNNING"
if%errorlevel%NEQ 0 (
echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - https://%mas%/troubleshoot.html
echo:
echo:
ping 127.0.0.1 -n 10
)
cls
:: Check LF line ending
pushd"%~dp0"
>nul findstr /rxc:".*""%~nx0"
ifnot%errorlevel%==0 (
>nul findstr /v "$""%~nx0"&&(
echo:
echo Error: Script either has LF line ending issue, or it failed to read itself.
echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
echo:
ping 127.0.0.1 -n 6 >nul
popd
@ -94,21 +117,25 @@ for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
@@ -94,21 +117,25 @@ for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
call:dk_color%Magenta%"Windows Update Service [wuauserv] is not working. Enable it incase if you have disabled it."
call:dk_color%Blue%"Windows Update is not working. Enable it incase if you have disabled it."
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv /v WubLock %nul%&&call:dk_color%Blue%"Sordum Windows Update Blocker tool has been used to block updates."
@ -448,6 +511,11 @@ call :dk_color %Red% "Changing Windows Region To USA [Failed]"
@@ -448,6 +511,11 @@ call :dk_color %Red% "Changing Windows Region To USA [Failed]"
:: In some cases clipup -v -o method fails and in some cases service restart method fails as well
:: To maximize success rate and get better error details, script will install tickets two times (service restart + clipup -v -o)
ifnotexist%SystemRoot%\system32\ClipUp.exe (
call:dk_color%Red%"Checking ClipUp.exe File [Not found, aborting the process]"
@ -522,6 +596,8 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
@@ -522,6 +596,8 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
if%_wmic%EQU 1 wmic path SoftwareLicensingProduct where (LicenseStatus='1' and GracePeriodRemaining='0' and PartialProductKey is not NULL) get Name /value 2>nul| findstr /i "Windows"1>nul&&set_perm=1||set_perm=
if%_wmic%EQU 0 %psc%"(([WMISEARCHER]'SELECT Name FROM SoftwareLicensingProduct WHERE LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').Get()).Name | %% {echo ('Name='+$_)}"2>nul| findstr /i "Windows"1>nul&&set_perm=1||set_perm=
if%_wmic%EQU 1 wmic path SoftwareLicensingProduct where (LicenseStatus='1' and GracePeriodRemaining='0' and PartialProductKey is not NULL) get Name /value %nul2%| findstr /i "Windows"%nul1%&&set_perm=1||set_perm=
if%_wmic%EQU 0 %psc%"(([WMISEARCHER]'SELECT Name FROM SoftwareLicensingProduct WHERE LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').Get()).Name | %% {echo ('Name='+$_)}"%nul2%| findstr /i "Windows"%nul1%&&set_perm=1||set_perm=
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE"2^>nul')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}"2^>nul')"
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}"%nul6%')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
exit /b
:: Get Activation IDs from licensing files if not found through WMI
call:dk_color%Magenta%"Restart the system to fix disabled service error 1058."
call:dk_color%Blue%"Restart the system to fix disabled service error 1058."
setshowfix=1
)
)
@ -763,61 +902,51 @@ call :dk_color %Magenta% "Restart the system to fix disabled service error 1058.
@@ -763,61 +902,51 @@ call :dk_color %Magenta% "Restart the system to fix disabled service error 1058.
ifdefinedsafeboot_option(
seterror=1
call:dk_color2%Red%"Checking Boot Mode "%Magenta%"[System is running in safe mode. Run in normal mode.]"
setshowfix=1
call:dk_color2%Red%"Checking Boot Mode "%Blue%"[System is running in safe mode. Run in normal mode.]"
call:dk_color%Gray%"Checking SvcRestartTask Last Run [Issues Found, !task!]"
call:dk_color%Gray%"Windows may face issues in keeping activation. Help: https://%mas%/troubleshoot"
)
)
:: Below checks are performed if required services are not disabled + slmgr /dlv errorlevel is not Zero + Rearm restart is not required + WMI is working fine
:: Below checks are performed if required services are not disabled or corrupted + if there is any error + slmgr /dlv errorlevel is not Zero + no fix was shown before
:: 5th column = Ticket signature value. It's as it is, it's not encoded. (Check https://massgrave.dev/hwid.html#Manual_Activation to see how it's generated)
:: 5th column = Ticket signature value. It's as it is, it's not encoded. (Check massgrave[.]dev/hwid.html#Manual_Activation to see how it's generated)
:: 6th column = 1 = activation is not working (at the time of writing this), 0 = activation is working
:: 7th column = Key Type
:: 8th column = WMI Edition ID
:: 8th column = WMI Edition ID (For reference only)
:: 9th column = Version name incase same Edition ID is used in different OS versions with different key
:: Check if Null service is working, it's important for the batch script
sc query Null | find /i "RUNNING"
if%errorlevel%NEQ 0 (
echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - https://%mas%/troubleshoot.html
echo:
echo:
ping 127.0.0.1 -n 10
)
cls
:: Check LF line ending
pushd"%~dp0"
>nul findstr /rxc:".*""%~nx0"
ifnot%errorlevel%==0 (
>nul findstr /v "$""%~nx0"&&(
echo:
echo Error: Script either has LF line ending issue, or it failed to read itself.
echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
echo:
ping 127.0.0.1 -n 6 >nul
popd
@ -98,21 +121,25 @@ for %%A in (%_act% %_rem% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=
@@ -98,21 +121,25 @@ for %%A in (%_act% %_rem% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=
@ -384,7 +443,6 @@ set key=
@@ -384,7 +443,6 @@ set key=
setpkey=
setaltkey=
setchangekey=
setcuredition=
setaltedition=
ifdefinedapplistcall:kms38data getkey
@ -394,6 +452,14 @@ if defined applist if not defined key call :kms38fallback
@@ -394,6 +452,14 @@ if defined applist if not defined key call :kms38fallback
call:dk_color%Magenta%"[%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:
)
set_partial=
ifnotdefinedkey(
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%# in('wmic path SoftwareLicensingProduct where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey<>null" Get PartialProductKey /value 2^>nul')doset"_partial=%%#"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%# in('%psc% "(([WMISEARCHER]'SELECT PartialProductKey FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL').Get()).PartialProductKey |%% {echo ('PartialProductKey='+$_)}"2^>nul') do set "_partial=%%#"
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%# in('wmic path SoftwareLicensingProduct where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey<>null" Get PartialProductKey /value %nul6%')doset"_partial=%%#"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%# in('%psc% "(([WMISEARCHER]'SELECT PartialProductKey FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL').Get()).PartialProductKey |%% {echo ('PartialProductKey='+$_)}"%nul6%') do set "_partial=%%#"
call:dk_color%Magenta%"In MAS, Goto Troubleshoot and run Fix Licensing option."
call:dk_color%Blue%"%_fixmsg%"
setshowfix=1
)
seterror=1
@ -452,8 +518,8 @@ set error=1
@@ -452,8 +518,8 @@ set error=1
:: Check activation ID for setting specific KMS host
setapp=
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%a in('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL) get ID /VALUE" 2^>nul')docallset"app=%%a"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%a in('%psc% "(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL').Get()).ID |%% {echo ('ID='+$_)}"2^>nul') do call set "app=%%a"
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%a in('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL) get ID /VALUE" %nul6%')docallset"app=%%a"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%a in('%psc% "(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL').Get()).ID |%% {echo ('ID='+$_)}"%nul6%') do call set "app=%%a"
ifnotdefinedapp(
call:dk_color%Red%"Checking Installed GVLK Activation ID [Not Found] Aborting..."
@ -518,7 +589,7 @@ if exist "%ProgramData%\Microsoft\Windows\ClipSVC\Install\Migration\*" del /f /q
@@ -518,7 +589,7 @@ if exist "%ProgramData%\Microsoft\Windows\ClipSVC\Install\Migration\*" del /f /q
:: Signature value is as it is, it's not encoded
:: Session ID is in Base64 encoded format. It's decoded value is "OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;GVLKExp=2038-01-19T03:14:07Z;DownlevelGenuineState=1;"
:: Check https://massgrave.dev/kms38.html#Manual_Activation to see how it's generated
:: Check massgrave[.]dev/kms38.html#Manual_Activation to see how it's generated
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%# in('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL) get GracePeriodRemaining /VALUE" 2^>nul')doset"gpr=%%#"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%# in('%psc% "(([WMISEARCHER]'SELECT GracePeriodRemaining FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL').Get()).GracePeriodRemaining |%% {echo ('GracePeriodRemaining='+$_)}"2^>nul') do set "gpr=%%#"
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%# in('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL) get GracePeriodRemaining /VALUE" %nul6%')doset"gpr=%%#"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%# in('%psc% "(([WMISEARCHER]'SELECT GracePeriodRemaining FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL').Get()).GracePeriodRemaining |%% {echo ('GracePeriodRemaining='+$_)}"%nul6%') do set "gpr=%%#"
if%_wmic%EQU 1 wmic path SoftwareLicensingProduct where (LicenseStatus='1' and GracePeriodRemaining='0' and PartialProductKey is not NULL) get Name /value 2>nul| findstr /i "Windows"1>nul&&set_perm=1||set_perm=
if%_wmic%EQU 0 %psc%"(([WMISEARCHER]'SELECT Name FROM SoftwareLicensingProduct WHERE LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').Get()).Name | %% {echo ('Name='+$_)}"2>nul| findstr /i "Windows"1>nul&&set_perm=1||set_perm=
if%_wmic%EQU 1 wmic path SoftwareLicensingProduct where (LicenseStatus='1' and GracePeriodRemaining='0' and PartialProductKey is not NULL) get Name /value %nul2%| findstr /i "Windows"%nul1%&&set_perm=1||set_perm=
if%_wmic%EQU 0 %psc%"(([WMISEARCHER]'SELECT Name FROM SoftwareLicensingProduct WHERE LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').Get()).Name | %% {echo ('Name='+$_)}"%nul2%| findstr /i "Windows"%nul1%&&set_perm=1||set_perm=
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%# in('wmic path SoftwareLicensingProduct where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey<>null" Get ProductKeyChannel /value 2^>nul')doset"_channel=%%#"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%# in('%psc% "(([WMISEARCHER]'SELECT ProductKeyChannel FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL').Get()).ProductKeyChannel |%% {echo ('ProductKeyChannel='+$_)}"2^>nul') do set "_channel=%%#"
if%_wmic%EQU 1 for/f"tokens=2 delims=="%%# in('wmic path SoftwareLicensingProduct where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey<>null" Get ProductKeyChannel /value %nul6%')doset"_channel=%%#"
if%_wmic%EQU 0 for/f"tokens=2 delims=="%%# in('%psc% "(([WMISEARCHER]'SELECT ProductKeyChannel FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL').Get()).ProductKeyChannel |%% {echo ('ProductKeyChannel='+$_)}"%nul6%') do set "_channel=%%#"
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE"2^>nul')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}"2^>nul')"
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}"%nul6%')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
call:dk_color%Magenta%"Restart the system to fix disabled service error 1058."
call:dk_color%Blue%"Restart the system to fix disabled service error 1058."
setshowfix=1
)
)
@ -940,61 +1047,51 @@ call :dk_color %Magenta% "Restart the system to fix disabled service error 1058.
@@ -940,61 +1047,51 @@ call :dk_color %Magenta% "Restart the system to fix disabled service error 1058.
ifdefinedsafeboot_option(
seterror=1
call:dk_color2%Red%"Checking Boot Mode "%Magenta%"[System is running in safe mode. Run in normal mode.]"
setshowfix=1
call:dk_color2%Red%"Checking Boot Mode "%Blue%"[System is running in safe mode. Run in normal mode.]"
call:dk_color%Gray%"Checking SvcRestartTask Last Run [Issues Found, !task!]"
call:dk_color%Gray%"Windows may face issues in keeping activation. Help: https://%mas%/troubleshoot"
)
)
:: Below checks are performed if required services are not disabled + slmgr /dlv errorlevel is not Zero + Rearm restart is not required + WMI is working fine
:: Below checks are performed if required services are not disabled or corrupted + if there is any error + slmgr /dlv errorlevel is not Zero + no fix was shown before
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE"2^>nul')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}"2^>nul')"
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}"%nul6%')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
exit /b
:: Get Edition list
:ced_edilist
if%_wmic%EQU 1 set"chkedi=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get LicenseFamily /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkedi=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT LicenseFamily FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).LicenseFamily ^|%% {echo ('LicenseFamily='+$_)}"%nul6%')"
%chkedi% do (call set "_wtarget= !_wtarget! %%a ")
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f') get ID /VALUE" 2^>nul')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f''').Get()).ID ^|%% {echo ('ID='+$_)}" 2^>nul')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
%psc%"(([WMISEARCHER]'SELECT Name FROM SoftwareLicensingProduct WHERE LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').Get()).Name"2>nul| findstr /i "Windows"1>nul&&(
%psc%"(([WMISEARCHER]'SELECT Name FROM SoftwareLicensingProduct WHERE LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').Get()).Name"%nul2%| findstr /i "Windows"%nul1%&&(
echo Windows is permanently activated.
echo Skipping rebuilding ClipSVC licences...
goto:cleanvnext
@ -460,7 +515,7 @@ for %%# in (wlidsvc LicenseManager) do (net stop %%# /y %nul% & net start %%# /y
@@ -460,7 +515,7 @@ for %%# in (wlidsvc LicenseManager) do (net stop %%# /y %nul% & net start %%# /y
<palign="center">A Windows and Office activator using HWID / KMS38 / Online KMS activation methods, with a focus on open-source code and fewer antivirus detections.</p>
<palign="center">A Windows and Office activator using HWID / Ohook / KMS38 / Online KMS activation methods, with a focus on open-source code and fewer antivirus detections.</p>
<hr>
## Download / How to use it?
@ -27,8 +27,8 @@
@@ -27,8 +27,8 @@
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches.html)