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."
ifnotdefinederrorcall:dk_color%Magenta%"In MAS, Goto Troubleshoot and run Fix Licensing option."
ifnotdefinederrorcall:dk_color%Blue% "%_fixmsg%"
call:dk_color2%Magenta%"Check this page for help"%_Yellow%" https://massgrave.dev/troubleshoot"
call:dk_color2%Blue% "Check this page for help"%_Yellow%" https://%mas%/troubleshoot"
)
)
)
)
@ -612,8 +703,8 @@ goto :dk_done
:dk_checkperm
:dk_checkperm
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 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='+$_)}"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='+$_)}"%nul2%| findstr /i "Windows"%nul1%&&set_perm=1||set_perm=
exit /b
exit /b
:: Refresh license status
:: Refresh license status
@ -642,18 +733,49 @@ exit /b
:dk_actids
:dk_actids
setapplist=
setapplist=
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 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='+$_)}"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='+$_)}"%nul6%')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
exit /b
exit /b
:: Get Activation IDs from licensing files if not found through WMI
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
:: 6th column = 1 = activation is not working (at the time of writing this), 0 = activation is working
:: 7th column = Key Type
:: 7th column = Key Type
:: 8th column = WMI Edition ID
:: 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
:: 9th column = Version name incase same Edition ID is used in different OS versions with different key
call:dk_color%Blue%"Windows must to be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
)
)
ifnotdefinedkeyifdefinednotfoundaltactID(
ifnotdefinedkeyifdefinednotfoundaltactID(
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]"
)
)
@ -403,7 +469,7 @@ if not defined key if not defined _gvlk (
echo [%winos%^|%winbuild%^| SKU:%osSKU%]
echo [%winos%^|%winbuild%^| SKU:%osSKU%]
echo Unable to find this product in the supported product list.
echo Unable to find this product in the supported product list.
echo Make sure you are using updated version of the script.
echo Make sure you are using updated version of the script.
echo https://massgrave.dev
echo https://%mas%
echo:
echo:
gotodk_done
gotodk_done
)
)
@ -414,14 +480,14 @@ goto dk_done
echo:
echo:
ifdefinedchangekey(
ifdefinedchangekey(
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:
echo:
)
)
set_partial=
set_partial=
ifnotdefinedkey(
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 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='+$_)}"2^>nul') do set "_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
setshowfix=1
)
)
seterror=1
seterror=1
@ -452,8 +518,8 @@ set error=1
:: Check activation ID for setting specific KMS host
:: Check activation ID for setting specific KMS host
setapp=
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 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='+$_)}"2^>nul') do call set "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(
ifnotdefinedapp(
call:dk_color%Red%"Checking Installed GVLK Activation ID [Not Found] Aborting..."
call:dk_color%Red%"Checking Installed GVLK Activation ID [Not Found] Aborting..."
@ -509,6 +575,11 @@ goto :k_final
:: In some cases clipup -v -o method fails and in some cases service restart method fails as well
:: 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)
:: 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]"
@ -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
:: 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;"
:: 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
call:dk_color%Magenta% "Protect KMS38 By KMS [Successful] [Locked A Registry Key]"
call:dk_color%Blue% "Protect KMS38 From KMS [Successful] [Locked A Registry Key]"
) || (
) || (
call:dk_color%Red%"Protect KMS38 By KMS [Failed To Lock A Registry Key]"
call:dk_color%Red%"Protect KMS38 From KMS [Failed To Lock A Registry Key]"
)
)
)
)
@ -731,7 +808,7 @@ $key.SetAccessControl($acl)
:k_actinfo
:k_actinfo
setxpr=
setxpr=
for/f"tokens=* delims="%%# in('%psc% "$([DateTime]::Now.addMinutes(%gpr%)).ToString('yyyy-MM-dd HH:mm:ss')"2^>nul') do set "xpr=%%#"
for/f"tokens=* delims="%%# in('%psc% "$([DateTime]::Now.addMinutes(%gpr%)).ToString('yyyy-MM-dd HH:mm:ss')"%nul6%') do set "xpr=%%#"
call:dk_color%Green%"%winos% is activated till !xpr!"
call:dk_color%Green%"%winos% is activated till !xpr!"
exit /b
exit /b
@ -740,8 +817,8 @@ exit /b
:k_checkexp
:k_checkexp
setgpr=0
setgpr=0
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 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='+$_)}"2^>nul') do set "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%gpr%GTR 259200 (set_k38=1)else(set_k38=)
if%gpr%GTR 259200 (set_k38=1)else(set_k38=)
exit /b
exit /b
@ -749,8 +826,8 @@ exit /b
:dk_checkperm
:dk_checkperm
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 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='+$_)}"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='+$_)}"%nul2%| findstr /i "Windows"%nul1%&&set_perm=1||set_perm=
exit /b
exit /b
:: Refresh license status
:: Refresh license status
@ -765,8 +842,8 @@ exit /b
:dk_channel
:dk_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 2^>nul')doset"_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='+$_)}"2^>nul') do set "_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=%%#"
exit /b
exit /b
:: Get Windows Activation IDs
:: Get Windows Activation IDs
@ -774,18 +851,31 @@ exit /b
:dk_actids
:dk_actids
setapplist=
setapplist=
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 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='+$_)}"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='+$_)}"%nul6%')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
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 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='+$_)}"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='+$_)}"%nul6%')"
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
exit /b
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 Windows is permanently activated.
echo Skipping rebuilding ClipSVC licences...
echo Skipping rebuilding ClipSVC licences...
goto:cleanvnext
goto:cleanvnext
@ -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>
<hr>
## Download / How to use it?
## Download / How to use it?
@ -27,8 +27,8 @@
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches.html)
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches.html)