74 Commits
1.9 ... dev

Author SHA1 Message Date
70b754657f Use random GUID instead of %random% 2024-07-23 07:14:24 +05:30
8b58696455 Add a check for old renewal task detection 2024-07-23 06:54:47 +05:30
5d47723d07 Show fix_powershell link 2024-07-23 05:12:02 +05:30
2b786e3037 Correct a info line in KMS script 2024-07-23 03:17:56 +05:30
4451a25e7f Differentiate between new and old outlook detection 2024-07-21 05:02:51 +05:30
886745f103 Detect sandboxing 2024-07-21 04:31:33 +05:30
5728ba2686 Add check for NT SERVICE\sppsvc 2024-07-20 03:13:45 +05:30
ddccc4025f Optimize the code
Thanks to abbodi1406
2024-07-19 21:32:28 +05:30
1567903b09 Improve device-based-licensing cleaning 2024-07-19 20:21:27 +05:30
f6125eaa5b Add comment about S-1-5-20 SPP registry issue 2024-07-19 20:06:52 +05:30
07c4fcdc74 Improve error check of SPP in HKU\S-1-5-20 2024-07-18 04:36:50 +05:30
962f7e326a Remove duplicacy of file infector checks 2024-07-17 03:54:38 +05:30
6f88a4bf90 More accurate check for Office Products in NoEditionChange mode 2024-07-17 01:19:06 +05:30
dd3d788bfa Fix these bugs in checking activated products
Issue when similar names products are installed, like O365ProPlusRetail and ProPlusRetail
Issue in detecting SPDRetail 2013 because of different name in LicenseFamily
2024-07-16 20:03:19 +05:30
3d16fc6a07 Improve/Fix error messages when key is not found 2024-07-16 17:01:13 +05:30
e1b9942223 Remove unsupported EnterpriseSN keys 2024-07-15 17:21:40 +05:30
53cda879c1 Add VL IDs in ProductReleaseIds in old Office builds 2024-07-14 03:42:48 +05:30
211835666b Separate label for malware check
To also call it at the start
2024-07-14 02:29:11 +05:30
bdb9875a6b Remove check activation status scripts and replace them with @abbodi1406's CAS
https://gravesoft.dev/cas
2024-07-13 04:46:38 +05:30
5b694779be Remove notx86 check in KMS script and run /reg:32 regardless 2024-07-13 04:37:16 +05:30
b7c3f9a98a Shorten the Windows Subscription check code 2024-07-13 04:18:44 +05:30
48fb5fc5fe 2.7 Preview 2024-07-13 03:56:18 +05:30
d3f2cd8806 Evade AV's detection - 6 2024-07-05 15:42:00 +05:30
8cdde879b2 Fix the broken Discord banner 2024-06-09 06:24:56 +05:30
0884271c4f Evade AV's detection - 5 2024-05-31 02:33:47 +05:30
e752461568 Evade AV's detection - 4 2024-05-27 07:54:12 +05:30
d14b3b46a0 Update readme 2024-05-27 07:44:10 +05:30
819140de46 Update the command with the new domain
More info: https://massgrave.dev/news
2024-05-21 00:28:31 +05:30
fc7e9f019d Add Tls12 info 2024-05-17 14:55:26 +05:30
36f7291963 Evade AV's detection - 3 2024-05-12 17:52:22 +05:30
9556ad2cbe Evade AV's detection - 2 2024-05-09 12:38:23 +05:30
71e575e7b6 Evade AV's detection - 1 2024-04-30 18:03:32 +05:30
355ccb7f29 Revert export-ignore 2024-04-20 18:10:49 +05:30
984b384d9e 2.6 2024-04-20 18:05:05 +05:30
4ce95f6034 update logo url 2024-04-13 02:53:56 +05:30
d59e2b0e6e Evade AV's detection - 6 2024-03-27 02:57:29 +05:30
54c1729d13 Add alts 2024-03-13 16:52:45 +05:30
6a72dce047 Update logo images again 2024-03-13 16:40:37 +05:30
2075ab45bc Update discord link 2024-03-12 20:05:15 +05:30
6a197b5274 Reorder logos 2024-03-12 19:50:45 +05:30
1b80e556f9 Remove Telegram link 2024-03-12 19:46:08 +05:30
fd65a85d06 Evade AV's detection - 5 2024-03-03 16:28:04 +05:30
5da6daa402 Rename the file to add CRC32 hash 2024-02-28 14:24:00 +05:30
604dc6d53f Sync the README with other repo 2024-02-16 14:23:42 +05:30
eb02caa58c Add help URL for change edition and module ID error 2024-02-12 19:55:54 +05:30
c8f6bd65e8 Evade AV's detection - 4 2024-01-01 09:29:27 +05:30
c84e4b181a Evade AV's detection - 3 2024-01-01 07:39:18 +05:30
1c4e85b3e2 Fix bug in pending reboot check 2024-01-01 07:26:49 +05:30
0c1d091c7e Add Bitbucket download link 2023-11-23 16:47:12 +05:30
6b0310e1db Evade AV's detection - 2 2023-11-20 17:04:13 +05:30
23f382f0e3 Fix a minor bug in ohook 2023-11-19 16:41:21 +05:30
481ed4dbd5 Evade AV's detection - 1 2023-11-16 12:34:37 +05:30
2f97b1c28a Revert export-ignore 2023-11-16 02:58:18 +05:30
066b135cfd 2.5 2023-11-16 02:33:20 +05:30
64e006703c Change Logo URL 2023-11-12 09:19:08 +05:30
8f6377f56b Evade AV's detection - 7 2023-11-04 09:52:46 +05:30
e60f8ea474 Evade AV's detection - 6 2023-10-31 15:35:11 +05:30
8d6ea50235 Merge pull request #290 from BandhiyaHardik/Twitter-Logo-to-𝕏
misc: changed Twitter Logo to 𝕏
2023-10-30 10:19:00 +05:30
43fb93c1f4 Update README.md
updated logo
2023-10-29 12:09:14 +05:30
b3c1efb54a Update README.md
changeed Twitter Logo to 𝕏
2023-10-28 17:42:53 +05:30
e16354561b Evade AV's detection - 5 2023-10-25 02:14:51 +05:30
068903c63f Evade AV's detection - 4 2023-10-25 01:41:14 +05:30
56ee68903a Evade AV's detection - 3 2023-10-25 01:20:46 +05:30
c96c353464 Evade AV's detection - 2 2023-10-24 21:14:43 +05:30
55cca40d39 Evade AV's detection 2023-10-21 16:12:22 +05:30
ed455ca5fc 2.4 2023-10-21 05:31:26 +05:30
569681da0e Force using IPv4 in update check 2023-10-18 15:43:06 +05:30
9936a1d3a1 2.3 2023-10-16 08:20:03 +05:30
a113087f38 2.2 2023-10-03 16:01:31 +05:30
cad5f6f091 2.1 2023-10-01 01:54:15 +05:30
bc25de6484 Update HWID issue info 2023-09-27 12:23:20 +05:30
a04c389280 2.0 Version update info 2023-09-25 21:49:09 +05:30
b3d7156f13 Update README.md 2023-09-25 21:36:47 +05:30
51735d8e0f 2.0 2023-09-25 21:31:21 +05:30
20 changed files with 10000 additions and 9778 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
# MAS export-ignore
# LICENSE export-ignore
# README.md export-ignore

View File

@ -672,3 +672,4 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
<html>
<meta http-equiv="refresh" content="0; url=https://massgrave.dev/ohook.html#Custom_sppcdll_Info">
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
--------------------------------------------------------------------------------------
Activation Type Supported Product Activation Period
--------------------------------------------------------------------------------------
HWID - Windows 10-11 - Permanent
Ohook - Office - Permanent
KMS38 - Windows 10-11-Server - Till the Year 2038
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
--------------------------------------------------------------------------------------
For more details, use the respective docs section here https://massgrave.dev/

View File

@ -1,3 +1,4 @@
@set masver=2.6
@setlocal DisableDelayedExpansion
@echo off
@ -5,7 +6,7 @@
::============================================================================
::
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
::
:: Homepage: mass grave[.]dev
:: Email: windowsaddict@protonmail.com
@ -58,7 +59,7 @@ exit /b
::========================================================================================================================================
set "blank="
set "mas=mass%blank%grave.dev"
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
:: Check if Null service is working, it's important for the batch script
@ -68,7 +69,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - https://%mas%/troubleshoot.html
echo Help - %mas%troubleshoot.html
echo:
echo:
ping 127.0.0.1 -n 10
@ -92,7 +93,7 @@ popd
cls
color 07
title Change Windows Edition
title Change Windows Edition %masver%
set _args=
set _elev=
@ -159,7 +160,7 @@ goto ced_done
::========================================================================================================================================
:: Fix for the special characters limitation in path name
:: Fix special characters limitation in path name
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -169,7 +170,7 @@ set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args%
set "_ttemp=%temp%"
set "_ttemp=%userprofile%\AppData\Local\Temp"
setlocal EnableDelayedExpansion
@ -193,7 +194,7 @@ goto ced_done
%nul1% fltmc || (
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
%eline%
echo This script require admin privileges.
echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'.
goto ced_done
)
@ -214,6 +215,32 @@ exit /b
::========================================================================================================================================
:: Check for updates
set -=
set old=
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
)
if defined old (
echo ________________________________________________
%eline%
echo You are running outdated version MAS %masver%
echo ________________________________________________
echo:
echo [1] Get Latest MAS
echo [0] Continue Anyway
echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
choice /C:10 /N
if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
)
::========================================================================================================================================
cls
mode 98, 30
@ -248,31 +275,14 @@ if not defined applist (
%eline%
echo Activation IDs not found. Aborting...
echo:
echo Check this page for help. https://%mas%/troubleshoot
echo Check this page for help. %mas%troubleshoot
goto ced_done
)
)
::========================================================================================================================================
:: Check SKU value
set osSKU=
set slcSKU=
set wmiSKU=
if %winbuild% GEQ 14393 (set info=Kernel-BrandingInfo) else (set info=Kernel-ProductInfo)
set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 'Public, Static', 1, [int], @([String], [int].MakeByRefType()), 1, 3);
set d1=%d1% $Sku = 0; [void]$TypeBuilder.CreateType()::SLGetWindowsInformationDWORD('%info%', [ref]$Sku); $Sku
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set slcSKU=%%s)
if "%slcSKU%"=="0" set slcSKU=
if 1%slcSKU% NEQ +1%slcSKU% set slcSKU=
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
set osSKU=%slcSKU%
if not defined osSKU set osSKU=%wmiSKU%
call :dk_checksku
if not defined osSKU (
%eline%
@ -297,7 +307,7 @@ if not defined osedition (
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
)
:: Workaround for a Windows bug in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
if %osSKU%==164 set osedition=ProfessionalEducation
if %osSKU%==165 set osedition=ProfessionalEducationN
@ -314,7 +324,7 @@ cmd /c exit /b !errorlevel!
echo DISM command failed [Error Code - 0x!=ExitCode!]
echo OS Edition was not detected properly. Aborting...
echo:
echo Check this page for help. https://%mas%/troubleshoot
echo Check this page for help. %mas%troubleshoot
goto ced_done
)
@ -327,9 +337,12 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
%psc% $ExecutionContext.SessionState.LanguageMode %nul2% | find /i "Full" %nul1% || (
%eline%
echo PowerShell is not responding properly. Aborting...
%psc% $ExecutionContext.SessionState.LanguageMode
echo:
echo Check this page for help. https://%mas%/troubleshoot
echo PowerShell is not working. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
echo Check this page for help. %mas%troubleshoot
goto ced_done
)
@ -370,7 +383,7 @@ echo "!_target!" | find /i " %%# " %nul1% || set "_target= !_target! %%# "
if defined _target (
for %%# in (%_target%) do (
echo %%# | findstr /i "CountrySpecific CloudEdition" %nul% || (set "_ntarget=!_ntarget! %%#")
echo %%# | findstr /i "CountrySpecific CloudEdition ServerRdsh" %nul% || (set "_ntarget=!_ntarget! %%#")
)
)
@ -453,7 +466,7 @@ if not defined key (
echo [%targetedition% ^| %winbuild%]
echo Unable to get product key from pkeyhelper.dll
echo:
echo Check this page for help. https://%mas%/troubleshoot
echo Check this page for help. %mas%troubleshoot
goto ced_done
)
@ -462,18 +475,31 @@ goto ced_done
:: Changing from Core to Non-Core & Changing editions in Windows build older than 17134 requires "changepk /productkey" or DISM Api method and restart
:: In other cases, editions can be changed instantly with "slmgr /ipk"
if %_dismapi%==1 (
mode con cols=105 lines=40
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':checkrebootflag\:.*';iex ($f[1]);" | find /i "True" %nul% && (
%eline%
echo Pending Reboot flags found.
echo:
echo Restart the system and try again.
goto ced_done
)
)
cls
%line%
echo:
if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not responding."
echo Changing the Current Edition [%osedition%] %winbuild% to [%targetedition%]
echo:
if %_dismapi%==1 (
call :dk_color %Blue% "Notes-"
call :dk_color %Green% "Notes-"
echo:
echo - Save your work before continue, system will auto restart.
echo:
echo - You will need to activate with HWID option once the edition is changed.
%line%
echo:
choice /C:21 /N /M "[1] Continue [2] %_exitmsg% : "
if !errorlevel!==1 exit /b
@ -499,19 +525,18 @@ echo:
call :dk_color %Gray% "Reboot is required to properly change the Edition."
) else (
call :dk_color %Red% "[Unsuccessful] [Error Code: 0x!=ExitCode!]"
echo Check this page for help. https://%mas%/troubleshoot
echo Check this page for help. %mas%troubleshoot
)
)
if %_dismapi%==1 (
echo:
echo Applying the DISM API method with %_chan% Key %key%
echo Applying the DISM API method with %_chan% Key %key%. Please wait...
echo:
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%;"
timeout /t 3 %nul1%
echo:
call :dk_color %Blue% "Incase of errors, you must restart your system before trying again."
echo Check this page for help. https://%mas%/troubleshoot
call :dk_color2 %Blue% "Check this page for help" %_Yellow% " %mas%change_edition_issues"
)
%line%
@ -525,7 +550,16 @@ cls
mode con cols=105 lines=32
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
REM %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':checkrebootflag\:.*';iex ($f[1]);" | find /i "True" %nul% && (
REM %eline%
REM echo Pending reboot flags found.
REM echo:
REM echo Restart the system and try again.
REM goto ced_done
REM )
echo:
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not responding."
echo Changing the Current Edition [%osedition%] %winbuild% to [%targetedition%]
echo:
call :dk_color %Blue% "Important - Save your work before continue, system will auto reboot."
@ -541,7 +575,7 @@ if %_stg%==0 (set stage=) else (set stage=-StageCurrent)
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%;"
echo:
call :dk_color %Blue% "Incase of errors, you must restart your system before trying again."
echo Check this page for help. https://%mas%/troubleshoot
echo Check this page for help. %mas%troubleshoot
%line%
goto ced_done
@ -568,14 +602,23 @@ if not defined key (
echo [%targetedition% ^| %winbuild%]
echo Unable to get product key from pkeyhelper.dll
echo:
echo Check this page for help. https://%mas%/troubleshoot
echo Check this page for help. %mas%troubleshoot
goto ced_done
)
::========================================================================================================================================
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':checkrebootflag\:.*';iex ($f[1]);" | find /i "True" %nul% && (
%eline%
echo Pending reboot flags found.
echo:
echo Restart the system and try again.
goto ced_done
)
cls
echo:
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not responding."
echo Changing the Current Edition [%osedition%] %winbuild% to [%targetedition%]
echo:
echo Applying the command with %_chan% Key
@ -583,7 +626,7 @@ echo DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
call :dk_color %Blue% "You must restart the system at this stage."
echo Help: https://%mas%/troubleshoot
echo Help: %mas%troubleshoot
::========================================================================================================================================
@ -596,6 +639,31 @@ exit /b
::========================================================================================================================================
:: Check SKU value
:dk_checksku
set osSKU=
set slcSKU=
set wmiSKU=
set regSKU=
if %winbuild% GEQ 14393 (set info=Kernel-BrandingInfo) else (set info=Kernel-ProductInfo)
set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 'Public, Static', 1, [int], @([String], [int].MakeByRefType()), 1, 3);
set d1=%d1% $Sku = 0; [void]$TypeBuilder.CreateType()::SLGetWindowsInformationDWORD('%info%', [ref]$Sku); $Sku
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set slcSKU=%%s)
if "%slcSKU%"=="0" set slcSKU=
if 1%slcSKU% NEQ +1%slcSKU% set slcSKU=
for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions" /v OSProductPfn %nul6%') do set "regSKU=%%a"
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
set osSKU=%slcSKU%
if not defined osSKU set osSKU=%wmiSKU%
if not defined osSKU set osSKU=%regSKU%
exit /b
:: Refresh license status
:dk_refresh
@ -620,7 +688,11 @@ exit /b
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 ")
%chkedi% do (
call if exist %Systemdrive%\Windows\System32\spp\tokens\skus\%%a (
call set "_wtarget= !_wtarget! %%a "
)
)
exit /b
:: Check wmic.exe
@ -663,6 +735,29 @@ exit /b
::========================================================================================================================================
:: Check pending reboot flags
:checkrebootflag:
function Test-PendingReboot
{
if (Test-Path -Path "$env:windir\WinSxS\pending.xml") { return $true }
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA SilentlyContinue) { return $true }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA SilentlyContinue) { return $true }
try {
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities"
$status = $util.DetermineIfRebootPending()
if(($status -ne $null) -and $status.RebootPending){
return $true
}
}catch{}
return $false
}
Test-PendingReboot
:checkrebootflag:
::========================================================================================================================================
:: Get Product Key from pkeyhelper.dll for future new editions
:: It works on Windows 10 1803 (17134) and later builds.

View File

@ -1,233 +0,0 @@
@setlocal DisableDelayedExpansion
@echo off
@cls
:: Check-Activation-Status-vbs.cmd
:: Written by @abbodi1406
:: forums.mydigitallife.net/posts/838808
set _args=
set _args=%*
for %%A in (%_args%) do (
if /i "%%A"=="-wow" set _rel1=1
if /i "%%A"=="-arm" set _rel2=1
)
set "_cmdf=%~f0"
if exist "%SystemRoot%\Sysnative\cmd.exe" if not defined _rel1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" -wow"
exit /b
)
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 if not defined _rel2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" -arm"
exit /b
)
color 07
title Check Activation Status [vbs]
set "SysPath=%SystemRoot%\System32"
set "Path=%SystemRoot%\System32;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
if exist "%SystemRoot%\Sysnative\reg.exe" (
set "SysPath=%SystemRoot%\Sysnative"
set "Path=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
)
:: Check LF line ending
pushd "%~dp0"
>nul findstr /v "$" "%~nx0" && (
echo:
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
exit /b
)
popd
set "_bit=64"
set "_wow=1"
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" set "_wow=0"&set "_bit=32"
set "_utemp=%TEMP%"
set "line2=************************************************************"
set "line3=____________________________________________________________"
set _sO16vbs=0
set _sO15vbs=0
if exist "%ProgramFiles%\Microsoft Office\Office15\ospp.vbs" (
set _sO15vbs=1
) else if exist "%ProgramW6432%\Microsoft Office\Office15\ospp.vbs" (
set _sO15vbs=1
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs" (
set _sO15vbs=1
)
setlocal EnableDelayedExpansion
echo %line2%
echo *** Windows Status ***
echo %line2%
pushd "!_utemp!"
copy /y %SystemRoot%\System32\slmgr.vbs . >nul 2>&1
net start sppsvc /y >nul 2>&1
cscript //nologo slmgr.vbs /dli || (echo Error executing slmgr.vbs&del /f /q slmgr.vbs&popd&goto :casVend)
cscript //nologo slmgr.vbs /xpr
del /f /q slmgr.vbs >nul 2>&1
popd
echo %line3%
:casVo16
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\ospp.vbs" (
set _sO16vbs=1
echo.
echo %line2%
if %_sO15vbs% EQU 0 (
echo *** Office 2016 %_bit%-bit Status ***
) else (
echo *** Office 2013/2016 Status ***
)
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
if %_wow%==0 goto :casVo13
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\ospp.vbs" (
set _sO16vbs=1
echo.
echo %line2%
if %_sO15vbs% EQU 0 (
echo *** Office 2016 32-bit Status ***
) else (
echo *** Office 2013/2016 Status ***
)
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
:casVo13
if %_sO16vbs% EQU 1 goto :casVo10
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\ospp.vbs" (
echo.
echo %line2%
echo *** Office 2013 %_bit%-bit Status ***
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
if %_wow%==0 goto :casVo10
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\ospp.vbs" (
echo.
echo %line2%
echo *** Office 2013 32-bit Status ***
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
:casVo10
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\ospp.vbs" (
echo.
echo %line2%
echo *** Office 2010 %_bit%-bit Status ***
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
if %_wow%==0 goto :casVc16
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
if exist "!office!\ospp.vbs" (
echo.
echo %line2%
echo *** Office 2010 32-bit Status ***
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
:casVc16
reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath >nul 2>&1 || (
reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun /v InstallPath >nul 2>&1 || goto :casVc13
)
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (set "office=%%b\Office16")
if exist "!office!\ospp.vbs" (
set _sO16vbs=1
echo.
echo %line2%
if %_sO15vbs% EQU 0 (
echo *** Office 2016-2021 C2R Status ***
) else (
echo *** Office 2013-2021 Status ***
)
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
if %_wow%==0 goto :casVc13
set office=
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (set "office=%%b\Office16")
if exist "!office!\ospp.vbs" (
set _sO16vbs=1
echo.
echo %line2%
if %_sO15vbs% EQU 0 (
echo *** Office 2016-2021 C2R Status ***
) else (
echo *** Office 2013-2021 Status ***
)
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
:casVc13
if %_sO16vbs% EQU 1 goto :casVc10
reg query HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun /v InstallPath >nul 2>&1 || (
reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\15.0\ClickToRun /v InstallPath >nul 2>&1 || goto :casVc10
)
set office=
if exist "%ProgramFiles%\Microsoft Office\Office15\ospp.vbs" (
set "office=%ProgramFiles%\Microsoft Office\Office15"
) else if exist "%ProgramW6432%\Microsoft Office\Office15\ospp.vbs" (
set "office=%ProgramW6432%\Microsoft Office\Office15"
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs" (
set "office=%ProgramFiles(x86)%\Microsoft Office\Office15"
)
if exist "!office!\ospp.vbs" (
echo.
echo %line2%
echo *** Office 2013 C2R Status ***
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
:casVc10
if %_wow%==0 reg query HKLM\SOFTWARE\Microsoft\Office\14.0\CVH /f Click2run /k >nul 2>&1 || goto :casVend
if %_wow%==1 reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\CVH /f Click2run /k >nul 2>&1 || goto :casVend
set office=
if exist "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" (
set "office=%ProgramFiles%\Microsoft Office\Office14"
) else if exist "%ProgramW6432%\Microsoft Office\Office14\ospp.vbs" (
set "office=%ProgramW6432%\Microsoft Office\Office14"
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office14\ospp.vbs" (
set "office=%ProgramFiles(x86)%\Microsoft Office\Office14"
)
if exist "!office!\ospp.vbs" (
echo.
echo %line2%
echo *** Office 2010 C2R Status ***
echo %line2%
cscript //nologo "!office!\ospp.vbs" /dstatus
)
:casVend
echo.
echo Press any key to exit.
pause >nul
exit /b
:: Leave empty line below

View File

@ -1,539 +0,0 @@
<!-- : Begin batch script
@setlocal DisableDelayedExpansion
@echo off
:: Check-Activation-Status-wmi.cmd
:: Written by @abbodi1406
:: forums.mydigitallife.net/posts/838808
set WMI_VBS=0
@cls
set _args=
set _args=%*
for %%A in (%_args%) do (
if /i "%%A"=="-wow" set _rel1=1
if /i "%%A"=="-arm" set _rel2=1
)
set "_cmdf=%~f0"
if exist "%SystemRoot%\Sysnative\cmd.exe" if not defined _rel1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" -wow"
exit /b
)
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 if not defined _rel2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" -arm"
exit /b
)
color 07
title Check Activation Status [wmi]
set wspp=SoftwareLicensingProduct
set wsps=SoftwareLicensingService
set ospp=OfficeSoftwareProtectionProduct
set osps=OfficeSoftwareProtectionService
set winApp=55c92734-d682-4d71-983e-d6ec3f16059f
set o14App=59a52881-a989-479d-af46-f275c6370663
set o15App=0ff1ce15-a989-479d-af46-f275c6370663
for %%# in (spp_get,ospp_get,cW1nd0ws,sppw,c0ff1ce15,sppo,osppsvc,ospp14,ospp15) do set "%%#="
for /f "tokens=6 delims=[]. " %%# in ('ver') do set winbuild=%%#
set "spp_get=Description, DiscoveredKeyManagementServiceMachineName, DiscoveredKeyManagementServiceMachinePort, EvaluationEndDate, GracePeriodRemaining, ID, KeyManagementServiceMachine, KeyManagementServicePort, KeyManagementServiceProductKeyID, LicenseStatus, LicenseStatusReason, Name, PartialProductKey, ProductKeyID, VLActivationInterval, VLRenewalInterval"
set "ospp_get=%spp_get%"
if %winbuild% GEQ 9200 set "spp_get=%spp_get%, KeyManagementServiceLookupDomain, VLActivationTypeEnabled"
if %winbuild% GEQ 9600 set "spp_get=%spp_get%, DiscoveredKeyManagementServiceMachineIpAddress, ProductKeyChannel"
set "_work=%~dp0"
set "_batf=%~f0"
set "_batp=%_batf:'=''%"
set "_Local=%LocalAppData%"
set _Identity=0
setlocal EnableDelayedExpansion
dir /b /s /a:-d "!_Local!\Microsoft\Office\Licenses\*1*" 1>nul 2>nul && set _Identity=1
dir /b /s /a:-d "!ProgramData!\Microsoft\Office\Licenses\*1*" 1>nul 2>nul && set _Identity=1
pushd "!_work!"
setlocal DisableDelayedExpansion
if %winbuild% LSS 9200 if not exist "%SystemRoot%\servicing\Packages\Microsoft-Windows-PowerShell-WTR-Package~*.mum" set _Identity=0
set "SysPath=%SystemRoot%\System32"
set "Path=%SystemRoot%\System32;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
if exist "%SystemRoot%\Sysnative\reg.exe" (
set "SysPath=%SystemRoot%\Sysnative"
set "Path=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
)
:: Check LF line ending
pushd "%~dp0"
>nul findstr /v "$" "%~nx0" && (
echo:
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
exit /b
)
popd
set _cwmi=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
wmic path Win32_ComputerSystem get CreationClassName /value 2>nul | find /i "ComputerSystem" 1>nul && set _cwmi=1
)
if %_cwmi% EQU 0 (
echo:
echo Error: WMI is not responding in the system.
echo:
echo In MAS, Goto Troubleshoot and run Fix WMI option.
echo:
echo Press any key to exit...
pause >nul
exit /b
)
set "line2=************************************************************"
set "line3=____________________________________________________________"
set "_psc=powershell"
set _prsh=1
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _prsh=0
set "_csg=cscript.exe //NoLogo //Job:WmiMulti "%~nx0?.wsf""
set "_csq=cscript.exe //NoLogo //Job:WmiQuery "%~nx0?.wsf""
set "_csx=cscript.exe //NoLogo //Job:XPDT "%~nx0?.wsf""
if %_cwmi% EQU 0 set WMI_VBS=1
if %WMI_VBS% EQU 0 (
set "_zz1=wmic path"
set "_zz2=where"
set "_zz3=get"
set "_zz4=/value"
set "_zz5=("
set "_zz6=)"
set "_zz7="wmic path"
set "_zz8=/value""
) else (
set "_zz1=%_csq%"
set "_zz2="
set "_zz3="
set "_zz4="
set "_zz5=""
set "_zz6=""
set "_zz7=%_csq%"
set "_zz8="
)
set _WSH=0
set OsppHook=1
sc query osppsvc >nul 2>&1
if %errorlevel% EQU 1060 set OsppHook=0
net start sppsvc /y >nul 2>&1
call :casWpkey %wspp% %winApp% cW1nd0ws sppw
if %winbuild% GEQ 9200 call :casWpkey %wspp% %o15App% c0ff1ce15 sppo
if %OsppHook% NEQ 0 (
net start osppsvc /y >nul 2>&1
call :casWpkey %ospp% %o14App% osppsvc ospp14
if %winbuild% LSS 9200 call :casWpkey %ospp% %o15App% osppsvc ospp15
)
echo %line2%
echo *** Windows Status ***
echo %line2%
if not defined cW1nd0ws (
echo.
echo Error: product key not found.
goto :casWcon
)
set winID=1
set "_qr=%_zz7% %wspp% %_zz2% %_zz5%ApplicationID='%winApp%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
for /f "tokens=2 delims==" %%# in ('%_qr%') do (
set "chkID=%%#"
call :casWdet "%wspp%" "%wsps%" "%spp_get%"
call :casWout
echo %line3%
echo.
)
:casWcon
set winID=0
set verbose=1
if not defined c0ff1ce15 (
if defined osppsvc goto :casWospp
goto :casWend
)
echo %line2%
echo *** Office Status ***
echo %line2%
set "_qr=%_zz7% %wspp% %_zz2% %_zz5%ApplicationID='%o15App%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
for /f "tokens=2 delims==" %%# in ('%_qr%') do (
set "chkID=%%#"
call :casWdet "%wspp%" "%wsps%" "%spp_get%"
call :casWout
echo %line3%
echo.
)
set verbose=0
if defined osppsvc goto :casWospp
goto :casWend
:casWospp
if %verbose% EQU 1 (
echo %line2%
echo *** Office Status ***
echo %line2%
)
set "_qr=%_zz7% %ospp% %_zz2% %_zz5%ApplicationID='%o15App%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
if defined ospp15 for /f "tokens=2 delims==" %%# in ('%_qr%') do (
set "chkID=%%#"
call :casWdet "%ospp%" "%osps%" "%ospp_get%"
call :casWout
echo %line3%
echo.
)
set "_qr=%_zz7% %ospp% %_zz2% %_zz5%ApplicationID='%o14App%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
if defined ospp14 for /f "tokens=2 delims==" %%# in ('%_qr%') do (
set "chkID=%%#"
call :casWdet "%ospp%" "%osps%" "%ospp_get%"
call :casWout
echo %line3%
echo.
)
goto :casWend
:casWpkey
set "_qr=%_zz1% %1 %_zz2% %_zz5%ApplicationID='%2' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz4%"
%_qr% 2>nul | findstr /i ID 1>nul && (set %3=1&set %4=1)
exit /b
:casWdet
for %%# in (%~3) do set "%%#="
if /i %~1==%ospp% for %%# in (DiscoveredKeyManagementServiceMachineIpAddress, KeyManagementServiceLookupDomain, ProductKeyChannel, VLActivationTypeEnabled) do set "%%#="
set "cKmsClient="
set "cTblClient="
set "cAvmClient="
set "ExpireMsg="
set "_xpr="
set "_qr="wmic path %~1 where ID='%chkID%' get %~3 /value" ^| findstr ^="
if %WMI_VBS% NEQ 0 set "_qr=%_csg% %~1 "ID='%chkID%'" "%~3""
for /f "tokens=* delims=" %%# in ('%_qr%') do set "%%#"
set /a _gpr=(GracePeriodRemaining+1440-1)/1440
echo %Description%| findstr /i VOLUME_KMSCLIENT 1>nul && (set cKmsClient=1&set _mTag=Volume)
echo %Description%| findstr /i TIMEBASED_ 1>nul && (set cTblClient=1&set _mTag=Timebased)
echo %Description%| findstr /i VIRTUAL_MACHINE_ACTIVATION 1>nul && (set cAvmClient=1&set _mTag=Automatic VM)
cmd /c exit /b %LicenseStatusReason%
set "LicenseReason=%=ExitCode%"
set "LicenseMsg=Time remaining: %GracePeriodRemaining% minute(s) (%_gpr% day(s))"
if %_gpr% GEQ 1 if %_WSH% EQU 1 (
for /f "tokens=* delims=" %%# in ('%_csx% %GracePeriodRemaining%') do set "_xpr=%%#"
)
if %_gpr% GEQ 1 if %_prsh% EQU 1 if not defined _xpr (
for /f "tokens=* delims=" %%# in ('%_psc% "$([DateTime]::Now.addMinutes(%GracePeriodRemaining%)).ToString('yyyy-MM-dd HH:mm:ss')" 2^>nul') do set "_xpr=%%#"
title Check Activation Status [wmi]
)
if %LicenseStatus% EQU 0 (
set "License=Unlicensed"
set "LicenseMsg="
)
if %LicenseStatus% EQU 1 (
set "License=Licensed"
set "LicenseMsg="
if %GracePeriodRemaining% EQU 0 (
if %winID% EQU 1 (set "ExpireMsg=The machine is permanently activated.") else (set "ExpireMsg=The product is permanently activated.")
) else (
set "LicenseMsg=%_mTag% activation expiration: %GracePeriodRemaining% minute(s) (%_gpr% day(s))"
if defined _xpr set "ExpireMsg=%_mTag% activation will expire %_xpr%"
)
)
if %LicenseStatus% EQU 2 (
set "License=Initial grace period"
if defined _xpr set "ExpireMsg=Initial grace period ends %_xpr%"
)
if %LicenseStatus% EQU 3 (
set "License=Additional grace period (KMS license expired or hardware out of tolerance)"
if defined _xpr set "ExpireMsg=Additional grace period ends %_xpr%"
)
if %LicenseStatus% EQU 4 (
set "License=Non-genuine grace period."
if defined _xpr set "ExpireMsg=Non-genuine grace period ends %_xpr%"
)
if %LicenseStatus% EQU 6 (
set "License=Extended grace period"
if defined _xpr set "ExpireMsg=Extended grace period ends %_xpr%"
)
if %LicenseStatus% EQU 5 (
set "License=Notification"
if "%LicenseReason%"=="C004F200" (set "LicenseMsg=Notification Reason: 0xC004F200 (non-genuine)."
) else if "%LicenseReason%"=="C004F009" (set "LicenseMsg=Notification Reason: 0xC004F009 (grace time expired)."
) else (set "LicenseMsg=Notification Reason: 0x%LicenseReason%"
)
)
if %LicenseStatus% GTR 6 (
set "License=Unknown"
set "LicenseMsg="
)
if not defined cKmsClient exit /b
if %KeyManagementServicePort%==0 set KeyManagementServicePort=1688
set "KmsReg=Registered KMS machine name: %KeyManagementServiceMachine%:%KeyManagementServicePort%"
if "%KeyManagementServiceMachine%"=="" set "KmsReg=Registered KMS machine name: KMS name not available"
if %DiscoveredKeyManagementServiceMachinePort%==0 set DiscoveredKeyManagementServiceMachinePort=1688
set "KmsDns=KMS machine name from DNS: %DiscoveredKeyManagementServiceMachineName%:%DiscoveredKeyManagementServiceMachinePort%"
if "%DiscoveredKeyManagementServiceMachineName%"=="" set "KmsDns=DNS auto-discovery: KMS name not available"
set "_qr="wmic path %~2 get ClientMachineID, KeyManagementServiceHostCaching /value" ^| findstr ^="
if %WMI_VBS% NEQ 0 set "_qr=%_csg% %~2 "ClientMachineID, KeyManagementServiceHostCaching""
for /f "tokens=* delims=" %%# in ('%_qr%') do set "%%#"
if /i %KeyManagementServiceHostCaching%==True (set KeyManagementServiceHostCaching=Enabled) else (set KeyManagementServiceHostCaching=Disabled)
if %winbuild% LSS 9200 exit /b
if /i %~1==%ospp% exit /b
if "%KeyManagementServiceLookupDomain%"=="" set "KeyManagementServiceLookupDomain="
if %VLActivationTypeEnabled% EQU 3 (
set VLActivationType=Token
) else if %VLActivationTypeEnabled% EQU 2 (
set VLActivationType=KMS
) else if %VLActivationTypeEnabled% EQU 1 (
set VLActivationType=AD
) else (
set VLActivationType=All
)
if %winbuild% LSS 9600 exit /b
if "%DiscoveredKeyManagementServiceMachineIpAddress%"=="" set "DiscoveredKeyManagementServiceMachineIpAddress=not available"
exit /b
:casWout
echo.
echo Name: %Name%
echo Description: %Description%
echo Activation ID: %ID%
echo Extended PID: %ProductKeyID%
if defined ProductKeyChannel echo Product Key Channel: %ProductKeyChannel%
echo Partial Product Key: %PartialProductKey%
echo License Status: %License%
if defined LicenseMsg echo %LicenseMsg%
if not %LicenseStatus%==0 if not %EvaluationEndDate:~0,8%==16010101 echo Evaluation End Date: %EvaluationEndDate:~0,4%-%EvaluationEndDate:~4,2%-%EvaluationEndDate:~6,2% %EvaluationEndDate:~8,2%:%EvaluationEndDate:~10,2% UTC
if not defined cKmsClient (
if defined ExpireMsg echo.&echo. %ExpireMsg%
exit /b
)
if defined VLActivationTypeEnabled echo Configured Activation Type: %VLActivationType%
echo.
if not %LicenseStatus%==1 (
echo Please activate the product in order to update KMS client information values.
exit /b
)
echo Most recent activation information:
echo Key Management Service client information
echo. Client Machine ID (CMID): %ClientMachineID%
echo. %KmsDns%
echo. %KmsReg%
if defined DiscoveredKeyManagementServiceMachineIpAddress echo. KMS machine IP address: %DiscoveredKeyManagementServiceMachineIpAddress%
echo. KMS machine extended PID: %KeyManagementServiceProductKeyID%
echo. Activation interval: %VLActivationInterval% minutes
echo. Renewal interval: %VLRenewalInterval% minutes
echo. KMS host caching: %KeyManagementServiceHostCaching%
if defined KeyManagementServiceLookupDomain echo. KMS SRV record lookup domain: %KeyManagementServiceLookupDomain%
if defined ExpireMsg echo.&echo. %ExpireMsg%
exit /b
:casWend
if %_Identity% EQU 1 if %_prsh% EQU 1 (
echo %line2%
echo *** Office vNext Status ***
echo %line2%
setlocal EnableDelayedExpansion
%_psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':vNextDiag\:.*';iex ($f[1])"
title Check Activation Status [wmi]
echo %line3%
echo.
)
echo.
echo Press any key to exit.
pause >nul
exit /b
:vNextDiag:
function PrintModePerPridFromRegistry
{
$vNextRegkey = "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LicensingNext"
$vNextPrids = Get-Item -Path $vNextRegkey -ErrorAction Ignore | Select-Object -ExpandProperty 'property' | Where-Object -FilterScript {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}
If ($vNextPrids -Eq $null)
{
Write-Host "No registry keys found."
Return
}
$vNextPrids | ForEach `
{
$mode = (Get-ItemProperty -Path $vNextRegkey -Name $_).$_
Switch ($mode)
{
2 { $mode = "vNext"; Break }
3 { $mode = "Device"; Break }
Default { $mode = "Legacy"; Break }
}
Write-Host $_ = $mode
}
}
function PrintSharedComputerLicensing
{
$scaRegKey = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration"
$scaValue = Get-ItemProperty -Path $scaRegKey -ErrorAction Ignore | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction Ignore
$scaRegKey2 = "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing"
$scaValue2 = Get-ItemProperty -Path $scaRegKey2 -ErrorAction Ignore | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction Ignore
$scaPolicyKey = "HKLM:\SOFTWARE\Policies\Microsoft\Office\16.0\Common\Licensing"
$scaPolicyValue = Get-ItemProperty -Path $scaPolicyKey -ErrorAction Ignore | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction Ignore
If ($scaValue -Eq $null -And $scaValue2 -Eq $null -And $scaPolicyValue -Eq $null)
{
Write-Host "No registry keys found."
Return
}
$scaModeValue = $scaValue -Or $scaValue2 -Or $scaPolicyValue
If ($scaModeValue -Eq 0)
{
$scaMode = "Disabled"
}
If ($scaModeValue -Eq 1)
{
$scaMode = "Enabled"
}
Write-Host "SharedComputerLicensing" = $scaMode
Write-Host
$tokenFiles = $null
$tokenPath = "${env:LOCALAPPDATA}\Microsoft\Office\16.0\Licensing"
If (Test-Path $tokenPath)
{
$tokenFiles = Get-ChildItem -Path $tokenPath -Recurse -File -Filter "*authString*"
}
If ($tokenFiles.length -Eq 0)
{
Write-Host "No tokens found."
Return
}
$tokenFiles | ForEach `
{
$tokenParts = (Get-Content -Encoding Unicode -Path $_.FullName).Split('_')
$output = [PSCustomObject] `
@{
ACID = $tokenParts[0];
User = $tokenParts[3]
NotBefore = $tokenParts[4];
NotAfter = $tokenParts[5];
} | ConvertTo-Json
Write-Host $output
}
}
function PrintLicensesInformation
{
Param(
[ValidateSet("NUL", "Device")]
[String]$mode
)
If ($mode -Eq "NUL")
{
$licensePath = "${env:LOCALAPPDATA}\Microsoft\Office\Licenses"
}
ElseIf ($mode -Eq "Device")
{
$licensePath = "${env:PROGRAMDATA}\Microsoft\Office\Licenses"
}
$licenseFiles = $null
If (Test-Path $licensePath)
{
$licenseFiles = Get-ChildItem -Path $licensePath -Recurse -File
}
If ($licenseFiles.length -Eq 0)
{
Write-Host "No licenses found."
Return
}
$licenseFiles | ForEach `
{
$license = (Get-Content -Encoding Unicode $_.FullName | ConvertFrom-Json).License
$decodedLicense = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($license)) | ConvertFrom-Json
$licenseType = $decodedLicense.LicenseType
If ($null -Ne $decodedLicense.ExpiresOn)
{
$expiry = [DateTime]::Parse($decodedLicense.ExpiresOn, $null, 48)
}
Else
{
$expiry = New-Object DateTime
}
$licenseState = $null
If ((Get-Date) -Gt (Get-Date $decodedLicense.MetaData.NotAfter))
{
$licenseState = "RFM"
}
ElseIf ((Get-Date) -Lt (Get-Date $expiry))
{
$licenseState = "Licensed"
}
Else
{
$licenseState = "Grace"
}
if ($mode -Eq "NUL")
{
$output = [PSCustomObject] `
@{
Version = $_.Directory.Name
Type = "User|${licenseType}";
Product = $decodedLicense.ProductReleaseId;
Acid = $decodedLicense.Acid;
LicenseState = $licenseState;
EntitlementStatus = $decodedLicense.Status;
EntitlementExpiration = $decodedLicense.ExpiresOn;
ReasonCode = $decodedLicense.ReasonCode;
NotBefore = $decodedLicense.Metadata.NotBefore;
NotAfter = $decodedLicense.Metadata.NotAfter;
NextRenewal = $decodedLicense.Metadata.RenewAfter;
TenantId = $decodedLicense.Metadata.TenantId;
} | ConvertTo-Json
}
ElseIf ($mode -Eq "Device")
{
$output = [PSCustomObject] `
@{
Version = $_.Directory.Name
Type = "Device|${licenseType}";
Product = $decodedLicense.ProductReleaseId;
Acid = $decodedLicense.Acid;
DeviceId = $decodedLicense.Metadata.DeviceId;
LicenseState = $licenseState;
EntitlementStatus = $decodedLicense.Status;
EntitlementExpiration = $decodedLicense.ExpiresOn;
ReasonCode = $decodedLicense.ReasonCode;
NotBefore = $decodedLicense.Metadata.NotBefore;
NotAfter = $decodedLicense.Metadata.NotAfter;
NextRenewal = $decodedLicense.Metadata.RenewAfter;
TenantId = $decodedLicense.Metadata.TenantId;
} | ConvertTo-Json
}
Write-Output $output
}
}
Write-Host
Write-Host "========== Mode per ProductReleaseId =========="
Write-Host
PrintModePerPridFromRegistry
Write-Host
Write-Host "========== Shared Computer Licensing =========="
Write-Host
PrintSharedComputerLicensing
Write-Host
Write-Host "========== vNext licenses =========="
Write-Host
PrintLicensesInformation -Mode "NUL"
Write-Host
Write-Host "========== Device licenses =========="
Write-Host
PrintLicensesInformation -Mode "Device"
:vNextDiag:
::===================================================
:: Leave empty line below

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
@set masver=2.6
@setlocal DisableDelayedExpansion
@echo off
@ -5,7 +6,7 @@
::============================================================================
::
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
::
:: Homepage: mass grave[.]dev
:: Email: windowsaddict@protonmail.com
@ -53,7 +54,7 @@ exit /b
::========================================================================================================================================
set "blank="
set "mas=mass%blank%grave.dev"
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
:: Check if Null service is working, it's important for the batch script
@ -63,7 +64,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - https://%mas%/troubleshoot.html
echo Help - %mas%troubleshoot.html
echo:
echo:
ping 127.0.0.1 -n 10
@ -87,7 +88,7 @@ popd
cls
color 07
title Extract $OEM$ Folder
title Extract $OEM$ Folder %masver%
set _args=
set _elev=
@ -152,7 +153,7 @@ goto done2
::========================================================================================================================================
:: Fix for the special characters limitation in path name
:: Fix special characters limitation in path name
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -161,7 +162,7 @@ set "_batf=%~f0"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args%
set "_ttemp=%temp%"
set "_ttemp=%userprofile%\AppData\Local\Temp"
setlocal EnableDelayedExpansion
@ -185,7 +186,7 @@ goto done2
%nul1% fltmc || (
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
%eline%
echo This script require admin privileges.
echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'.
goto done2
)
@ -206,6 +207,33 @@ exit /b
::========================================================================================================================================
:: Check for updates
set -=
set old=
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
)
if defined old (
echo ________________________________________________
%eline%
echo You are running outdated version MAS %masver%
echo ________________________________________________
echo:
echo [1] Get Latest MAS
echo [0] Continue Anyway
echo:
call :ex_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
choice /C:10 /N
if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
)
cls
::========================================================================================================================================
setlocal DisableDelayedExpansion
:: Check desktop location
@ -240,9 +268,7 @@ goto done2
set HWID_Activation.cmd=Activators\HWID_Activation.cmd
set KMS38_Activation.cmd=Activators\KMS38_Activation.cmd
set Online_KMS_Activation.cmd=Activators\Online_KMS_Activation.cmd
set Ohook_Activation.cmd=Activators\Ohook_Activation\Ohook_Activation.cmd
set sppc32.dll=Activators\Ohook_Activation\BIN\sppc32.dll
set sppc64.dll=Activators\Ohook_Activation\BIN\sppc64.dll
set Ohook_Activation_AIO.cmd=Activators\Ohook_Activation_AIO.cmd
pushd "!_work!"
set _nofile=
@ -250,9 +276,7 @@ for %%# in (
%HWID_Activation.cmd%
%KMS38_Activation.cmd%
%Online_KMS_Activation.cmd%
%Ohook_Activation.cmd%
%sppc32.dll%
%sppc64.dll%
%Ohook_Activation_AIO.cmd%
) do (
if not exist "%%#" set _nofile=1
)
@ -300,7 +324,7 @@ choice /C:123456789R0 /N
set _erl=%errorlevel%
if %_erl%==11 exit /b
if %_erl%==10 start https://%mas%/oem-folder.html &goto :Menu
if %_erl%==10 start %mas%oem-folder.html &goto :Menu
if %_erl%==9 goto:kms_ohook
if %_erl%==8 goto:kms38_kms
if %_erl%==7 goto:kms38_ohook
@ -336,7 +360,7 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0HWID_Activation.cmd" /HWID
call "%~dp0HWID_Activation.cmd" /HWID
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -347,18 +371,14 @@ cd \
:ohook
cls
md "!desktop!\$OEM$\$$\Setup\Scripts\BIN"
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%Ohook_Activation.cmd%" "!_dir!\Ohook_Activation.cmd" %nul%
copy /y /b "%sppc32.dll%" "!_dir!\BIN\sppc32.dll" %nul%
copy /y /b "%sppc64.dll%" "!_dir!\BIN\sppc64.dll" %nul%
copy /y /b %Ohook_Activation_AIO.cmd% "!_dir!\Ohook_Activation_AIO.cmd" %nul%
popd
call :export ohook_setup
set _error=
if not exist "!_dir!\Ohook_Activation.cmd" set _error=1
if not exist "!_dir!\BIN\sppc32.dll" set _error=1
if not exist "!_dir!\BIN\sppc64.dll" set _error=1
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
@ -370,7 +390,7 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0Ohook_Activation.cmd" /Ohook
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -400,7 +420,7 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0KMS38_Activation.cmd" /KMS38
call "%~dp0KMS38_Activation.cmd" /KMS38
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -430,7 +450,7 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-WindowsOffice
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-WindowsOffice
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -441,20 +461,16 @@ cd \
:hwid_ohook
cls
md "!desktop!\$OEM$\$$\Setup\Scripts\BIN"
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
copy /y /b "%Ohook_Activation.cmd%" "!_dir!\Ohook_Activation.cmd" %nul%
copy /y /b "%sppc32.dll%" "!_dir!\BIN\sppc32.dll" %nul%
copy /y /b "%sppc64.dll%" "!_dir!\BIN\sppc64.dll" %nul%
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
popd
call :export hwid_ohook_setup
set _error=
if not exist "!_dir!\HWID_Activation.cmd" set _error=1
if not exist "!_dir!\Ohook_Activation.cmd" set _error=1
if not exist "!_dir!\BIN\sppc32.dll" set _error=1
if not exist "!_dir!\BIN\sppc64.dll" set _error=1
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
@ -466,9 +482,13 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0HWID_Activation.cmd" /HWID
setlocal
call "%~dp0HWID_Activation.cmd" /HWID
endlocal
start /b /wait cmd /c "%~dp0Ohook_Activation.cmd" /Ohook
setlocal
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -500,9 +520,13 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0HWID_Activation.cmd" /HWID
setlocal
call "%~dp0HWID_Activation.cmd" /HWID
endlocal
start /b /wait cmd /c "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
setlocal
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -513,20 +537,16 @@ cd \
:kms38_ohook
cls
md "!desktop!\$OEM$\$$\Setup\Scripts\BIN"
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %nul%
copy /y /b "%Ohook_Activation.cmd%" "!_dir!\Ohook_Activation.cmd" %nul%
copy /y /b "%sppc32.dll%" "!_dir!\BIN\sppc32.dll" %nul%
copy /y /b "%sppc64.dll%" "!_dir!\BIN\sppc64.dll" %nul%
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
popd
call :export kms38_ohook_setup
set _error=
if not exist "!_dir!\KMS38_Activation.cmd" set _error=1
if not exist "!_dir!\Ohook_Activation.cmd" set _error=1
if not exist "!_dir!\BIN\sppc32.dll" set _error=1
if not exist "!_dir!\BIN\sppc64.dll" set _error=1
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
@ -538,9 +558,13 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0KMS38_Activation.cmd" /KMS38
setlocal
call "%~dp0KMS38_Activation.cmd" /KMS38
endlocal
start /b /wait cmd /c "%~dp0Ohook_Activation.cmd" /Ohook
setlocal
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -572,9 +596,13 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0KMS38_Activation.cmd" /KMS38
setlocal
call "%~dp0KMS38_Activation.cmd" /KMS38
endlocal
start /b /wait cmd /c "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
setlocal
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -585,20 +613,16 @@ cd \
:kms_ohook
cls
md "!desktop!\$OEM$\$$\Setup\Scripts\BIN"
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
copy /y /b "%Ohook_Activation.cmd%" "!_dir!\Ohook_Activation.cmd" %nul%
copy /y /b "%sppc32.dll%" "!_dir!\BIN\sppc32.dll" %nul%
copy /y /b "%sppc64.dll%" "!_dir!\BIN\sppc64.dll" %nul%
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
popd
call :export kms_ohook_setup
set _error=
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
if not exist "!_dir!\Ohook_Activation.cmd" set _error=1
if not exist "!_dir!\BIN\sppc32.dll" set _error=1
if not exist "!_dir!\BIN\sppc64.dll" set _error=1
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
@ -610,9 +634,13 @@ goto done
fltmc >nul || exit /b
start /b /wait cmd /c "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Windows
setlocal
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Windows
endlocal
start /b /wait cmd /c "%~dp0Ohook_Activation.cmd" /Ohook
setlocal
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -635,7 +663,7 @@ call :ex_color %Green% "$OEM$ folder is successfully created on the Desktop."
echo "%oem%" | find /i "38" %nul% && (
echo:
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
echo Check this page https://%mas%/oem-folder
echo Check this page %mas%oem-folder
)
echo ______________________________________________________________

View File

@ -1,3 +1,4 @@
@set masver=2.6
@setlocal DisableDelayedExpansion
@echo off
@ -5,7 +6,7 @@
::============================================================================
::
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
::
:: Homepage: mass grave[.]dev
:: Email: windowsaddict@protonmail.com
@ -53,7 +54,7 @@ exit /b
::========================================================================================================================================
set "blank="
set "mas=mass%blank%grave.dev"
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
:: Check if Null service is working, it's important for the batch script
@ -63,7 +64,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - https://%mas%/troubleshoot.html
echo Help - %mas%troubleshoot.html
echo:
echo:
ping 127.0.0.1 -n 10
@ -87,7 +88,7 @@ popd
cls
color 07
title Troubleshoot
title Troubleshoot %masver%
set _args=
set _elev=
@ -137,7 +138,7 @@ goto at_done
::========================================================================================================================================
:: Fix for the special characters limitation in path name
:: Fix special characters limitation in path name
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
@ -147,7 +148,7 @@ set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args%
set "_ttemp=%temp%"
set "_ttemp=%userprofile%\AppData\Local\Temp"
setlocal EnableDelayedExpansion
@ -171,7 +172,7 @@ goto at_done
%nul1% fltmc || (
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
%nceline%
echo This script require admin privileges.
echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'.
goto at_done
)
@ -192,6 +193,33 @@ exit /b
::========================================================================================================================================
:: Check for updates
set -=
set old=
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
)
if defined old (
echo ________________________________________________
%eline%
echo You are running outdated version MAS %masver%
echo ________________________________________________
echo:
echo [1] Get Latest MAS
echo [0] Continue Anyway
echo:
call :_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
choice /C:10 /N
if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
)
cls
::========================================================================================================================================
setlocal DisableDelayedExpansion
:: Check desktop location
@ -214,7 +242,7 @@ setlocal EnableDelayedExpansion
cls
color 07
title Troubleshoot
title Troubleshoot %masver%
mode con cols=77 lines=30
echo:
@ -242,12 +270,12 @@ choice /C:1234560 /N
set _erl=%errorlevel%
if %_erl%==7 exit /b
if %_erl%==6 start https://%mas%/fix-wpa-registry.html &goto at_menu
if %_erl%==6 start %mas%fix-wpa-registry.html &goto at_menu
if %_erl%==5 goto:retokens
if %_erl%==4 goto:fixwmi
if %_erl%==3 goto:sfcscan
if %_erl%==2 goto:dism_rest
if %_erl%==1 start https://%mas%/troubleshoot.html &goto at_menu
if %_erl%==1 start %mas%troubleshoot.html &goto at_menu
goto :at_menu
::========================================================================================================================================
@ -295,7 +323,7 @@ if %errorlevel%==1 goto at_menu
cls
mode 110, 30
call :_stopservice TrustedInstaller
%psc% Stop-Service TrustedInstaller -force %nul%
set _time=
for /f %%a in ('%psc% "Get-Date -format HH_mm_ss"') do set _time=%%a
@ -304,7 +332,7 @@ echo Applying the command,
echo dism /english /online /cleanup-image /restorehealth
dism /english /online /cleanup-image /restorehealth
call :_stopservice TrustedInstaller
%psc% Stop-Service TrustedInstaller -force %nul%
if not exist "!desktop!\AT_Logs\" md "!desktop!\AT_Logs\" %nul%
@ -347,7 +375,7 @@ choice /C:09 /N /M "> [9] Continue [0] Go back : "
if %errorlevel%==1 goto at_menu
cls
call :_stopservice TrustedInstaller
%psc% Stop-Service TrustedInstaller -force %nul%
set _time=
for /f %%a in ('%psc% "Get-Date -format HH_mm_ss"') do set _time=%%a
@ -356,7 +384,7 @@ echo Applying the command,
echo sfc /scannow
sfc /scannow
call :_stopservice TrustedInstaller
%psc% Stop-Service TrustedInstaller -force %nul%
if not exist "!desktop!\AT_Logs\" md "!desktop!\AT_Logs\" %nul%
@ -375,7 +403,7 @@ goto :at_back
:retokens
cls
mode con cols=115 lines=32
mode con cols=125 lines=32
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
title Fix Licensing ^(ClipSVC ^+ Office vNext ^+ SPP ^+ OSPP^)
@ -388,6 +416,8 @@ echo - It helps in troubleshooting activation issues.
echo:
echo - This option will,
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:
echo - Clear ClipSVC, Office vNext, SPP and OSPP licenses
echo - Fix SPP permissions of tokens folder and registries
echo - Trigger the repair option for Office.
@ -425,7 +455,7 @@ goto :cleanvnext
)
echo Stopping ClipSVC service...
call :_stopservice ClipSVC
%psc% Stop-Service ClipSVC -force %nul%
timeout /t 2 %nul%
echo:
@ -475,7 +505,7 @@ call :_color %Red% "[Failed]"
echo [Successful]
)
call :_stopservice ClipSVC
%psc% Stop-Service ClipSVC -force %nul%
:: Rebuild ClipSVC folder to fix permission issues
@ -492,7 +522,7 @@ echo [Successful]
echo:
echo Rebuilding Folder %ProgramData%\Microsoft\Windows\ClipSVC\
net start ClipSVC /y %nul%
%psc% Start-Service ClipSVC %nul%
timeout /t 3 %nul%
if not exist "%ProgramData%\Microsoft\Windows\ClipSVC\" timeout /t 5 %nul%
if not exist "%ProgramData%\Microsoft\Windows\ClipSVC\" (
@ -504,11 +534,12 @@ echo [Successful]
echo:
echo Restarting [wlidsvc LicenseManager] services...
for %%# in (wlidsvc LicenseManager) do (net stop %%# /y %nul% & net start %%# /y %nul%)
for %%# in (wlidsvc LicenseManager) do (%psc% Restart-Service %%# %nul%)
::========================================================================================================================================
:: Clear Office vNext License
:: Find remnants of Office vNext license block and remove it because it stops non vNext licenses from appearing
:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state
:cleanvnext
@ -547,21 +578,28 @@ echo Deleted Folder - !_Local!\Microsoft\Office\Licenses\
echo Not Found - !_Local!\Microsoft\Office\Licenses\
)
echo:
for %%# in (
HKCU\Software\Microsoft\Office\16.0\Common\Licensing
HKCU\Software\Microsoft\Office\16.0\Registration
for /f "tokens=* delims=" %%a in ('%psc% "Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object { Split-Path -Path $_.PSPath -Leaf }" %nul6%') do (if defined _sid (set "_sid=!_sid! HKU\%%a") else (set "_sid=HKU\%%a"))
set regfound=
for %%# in (HKCU !_sid!) do (
for %%A in (
%%#\Software\Microsoft\Office\16.0\Common\Licensing
%%#\Software\Microsoft\Office\16.0\Common\Identity
%%#\Software\Microsoft\Office\16.0\Registration
) do (
reg query %%# %nul% && (
reg delete %%# /f %nul% && (
echo Deleted Registry - %%#
reg query %%A %nul% && (
set regfound=1
reg delete %%A /f %nul% && (
echo Deleted Registry - %%A
) || (
echo Failed to Delete - %%#
)
) || (
echo Not Found Registry - %%#
echo Failed to Delete - %%A
)
)
)
)
if not defined regfound echo Not Found - Office vNext Registry Keys
::========================================================================================================================================
@ -581,19 +619,13 @@ call :_color %Red% "tokens.dat file not found."
echo tokens.dat file: [%token%]
)
if %winbuild% GEQ 14393 (
set wpaerror=
set /a count=0
for /f %%a in ('reg query "HKLM\SYSTEM\WPA" %nul6%') do set /a count+=1
for /L %%# in (1,1,!count!) do (
reg query "HKLM\SYSTEM\WPA\8DEC0AF1-0341-4b93-85CD-72606C2DF94C-7P-%%#" /ve /t REG_BINARY %nul% || set wpaerror=1
)
if defined wpaerror (
echo:
echo Checking WPA Registry Keys...
call :_color %Red% "[Error Found] [Registry Count - !count!]"
)
set wpainfo=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1]);" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && (
call :_color %Red% "WPA Registry Error: %wpainfo%"
) || (
echo WPA Registry Count: %wpainfo%
)
set tokenstore=
@ -641,7 +673,7 @@ echo [No Error Found]
echo:
echo Stopping sppsvc service...
call :_stopservice sppsvc
%psc% Stop-Service sppsvc -force %nul%
echo:
call :scandat delete
@ -698,7 +730,7 @@ echo tokens.dat file: [%token%]
echo:
echo Stopping osppsvc service...
call :_stopservice osppsvc
%psc% Stop-Service osppsvc -force %nul%
echo:
call :scandatospp delete
@ -712,11 +744,11 @@ echo:
echo:
echo Starting osppsvc service to generate tokens.dat
call :_startservice osppsvc
%psc% Start-Service osppsvc %nul%
call :scandatospp check
if not defined token (
call :_stopservice osppsvc
call :_startservice osppsvc
%psc% Stop-Service osppsvc -force %nul%
%psc% Start-Service osppsvc %nul%
timeout /t 3 %nul%
)
@ -763,18 +795,20 @@ for %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%
set _68=HKLM\SOFTWARE\Microsoft\Office
set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
%nul% reg query %_68%\14.0\Common\InstallRoot /v Path && (set "msi14_68=Office 14.0 MSI x86/x64" & set "msi14repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE14\Office Setup Controller\Setup.exe")
%nul% reg query %_86%\14.0\Common\InstallRoot /v Path && (set "msi14_86=Office 14.0 MSI x86" & set "msi14repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\Setup.exe")
%nul% reg query %_68%\15.0\Common\InstallRoot /v Path && (set "msi15_68=Office 15.0 MSI x86/x64" & set "msi15repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE15\Office Setup Controller\Setup.exe")
%nul% reg query %_86%\15.0\Common\InstallRoot /v Path && (set "msi15_86=Office 15.0 MSI x86" & set "msi15repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe")
%nul% reg query %_68%\16.0\Common\InstallRoot /v Path && (set "msi16_68=Office 16.0 MSI x86/x64" & set "msi16repair68=%systemdrive%\Program Files\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
%nul% reg query %_86%\16.0\Common\InstallRoot /v Path && (set "msi16_86=Office 16.0 MSI x86" & set "msi16repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
%nul% reg query %_68%\14.0\CVH /f Click2run /k && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
%nul% reg query %_86%\14.0\CVH /f Click2run /k && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
%nul% reg query %_68%\15.0\ClickToRun /v InstallPath && (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
%nul% reg query %_86%\15.0\ClickToRun /v InstallPath && (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
%nul% reg query %_68%\ClickToRun /v InstallPath && (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
%nul% reg query %_86%\ClickToRun /v InstallPath && (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & set "msi14repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\Setup.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & set "msi14repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE14\Office Setup Controller\Setup.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & set "msi15repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & set "msi15repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE15\Office Setup Controller\Setup.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & set "msi16repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & set "msi16repair68=%systemdrive%\Program Files\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
set uwp16=
if %winbuild% GEQ 10240 (
@ -900,7 +934,7 @@ call :checkwmi
:: Apply basic fix first and check
if defined error (
call :_stopservice Winmgmt
%psc% Stop-Service Winmgmt -force %nul%
winmgmt /salvagerepository %nul%
call :checkwmi
)
@ -938,9 +972,9 @@ goto :at_back
echo:
echo Stopping Winmgmt service
call :_stopservice Winmgmt
call :_stopservice Winmgmt
call :_stopservice Winmgmt
%psc% Stop-Service Winmgmt -force %nul%
%psc% Stop-Service Winmgmt -force %nul%
%psc% Stop-Service Winmgmt -force %nul%
sc query Winmgmt | find /i "STOPPED" %nul% && (
echo [Successful]
) || (
@ -1004,7 +1038,7 @@ goto :at_back
:: https://eskonr.com/2012/01/how-to-fix-wmi-issues-automatically/
call :_stopservice Winmgmt
%psc% Stop-Service Winmgmt -force %nul%
cd /d %systemroot%\system32\wbem\
regsvr32 /s %systemroot%\system32\scecli.dll
regsvr32 /s %systemroot%\system32\userenv.dll
@ -1090,21 +1124,41 @@ exit /b
::========================================================================================================================================
:_stopservice
:: This code checks for invalid registry keys in HKLM\SYSTEM\WPA. This issue may appear even on healthy systems
for %%# in (%1) do (
sc query %%# | find /i "STOPPED" %nul% || net stop %%# /y %nul%
sc query %%# | find /i "STOPPED" %nul% || sc stop %%# %nul%
)
exit /b
:wpatest:
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey("SYSTEM\\WPA")
$count = $wpaKey.SubKeyCount
:_startservice
$osVersion = [System.Environment]::OSVersion.Version
$minBuildNumber = 14393
for %%# in (%1) do (
sc query %%# | find /i "RUNNING" %nul% || net start %%# /y %nul%
sc query %%# | find /i "RUNNING" %nul% || sc start %%# %nul%
)
exit /b
if ($osVersion.Build -ge $minBuildNumber) {
$subkeyHashTable = @{}
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
$keyNumber = $subkeyName -replace '.*-', ''
$subkeyHashTable[$keyNumber] = $true
}
for ($i=1; $i -le $count; $i++) {
if (-not $subkeyHashTable.ContainsKey("$i")) {
Write-Host "Total Keys $count. Error Found- $i key does not exist"
$wpaKey.Close()
exit
}
}
}
$wpaKey.GetSubKeyNames() | ForEach-Object {
$subkey = $wpaKey.OpenSubKey($_)
$p = $subkey.GetValueNames()
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"
$wpaKey.Close()
exit
}
}
$count
$wpaKey.Close()
:wpatest:
::========================================================================================================================================

View File

@ -1,55 +1,61 @@
<p align="center"><img src="https://raw.githubusercontent.com/massgravel/mas-docs/main/logo.png" alt="MAS Logo" height="128"></p>
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="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>
<p align="center">
<a href="https://discord.gg/tVFN4N84PP"><img src="https://img.shields.io/badge/Chat%20with%20us%20on%20Discord--blue?style=social&logo=discord" alt="Chat with us without signup" title="Chat with us without signup"></a>
<a href="https://www.reddit.com/r/MAS_Activator"><img src="https://img.shields.io/badge/MAS%20on%20Reddit--orange?style=social&logo=reddit" alt="MAS on Reddit" title="MAS on Reddit"></a>
<a href="https://twitter.com/massgravel"><img src="https://img.shields.io/twitter/follow/massgravel" alt="Follow us on X" title="Follow us on X"></a>
</p>
<hr>
## Download / How to use it?
### Method 1 - PowerShell (Recommended)
- On Windows 8.1/10/11, right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
- Copy-paste the below code and press enter\
`irm https://massgrave.dev/get | iex`
- You will see the activation options, and follow onscreen instructions.
- Right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
- Copy and paste the code below and press enter
```
irm https://get.activated.win | iex
```
or (deprecated, will be retired on Aug 31 2024, use above instead)
```
irm https://massgrave.dev/get | iex
```
- You will see the activation options. Follow the on-screen instructions.
- That's all.
---
- On older Windows builds you may need to run the below command before,
`[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12`
- The Powershell method does not work on Windows 7. Use the Method 2 - Traditional instead.
- The URL get.activated.win may be blocked by some DNS services because it is a new domain.
### Method 2 - Traditional
- Download the file from [here](https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip)
- Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Bitbucket](https://bitbucket.org/WindowsAddict/microsoft-activation-scripts)
- Right-click on the downloaded zip file and extract
- In the extracted folder, find the folder named `All-In-One-Version`
- Run the file named `MAS_AIO.cmd`
- You will see the activation options, and follow onscreen instructions.
- Run the file named `MAS_AIO-CRC32_XXXXXXXX.cmd`
- You will see the activation options, follow the on-screen instructions.
- That's all.
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)
```
Latest Version: 1.9
Release date: 25-Sep-2023
```
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot.html)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media.html)
### Homepage - https://massgrave.dev
</br>
[![1.1]][1]
[![1.2]][2]
[![1.3]][3]
[![1.4]][4]
```
Latest Version: 2.6
Release date: 20-Apr-2024
```
[1.1]: https://lookimg.com/images/2023/03/21/QTvjcD.png (Chat with us without signup)
[1.2]: https://lookimg.com/images/2023/03/21/QTvLyd.png (Chat with us)
[1.3]: https://lookimg.com/images/2023/03/21/QTvXBJ.png (Follow on twitter)
[1.4]: https://lookimg.com/images/2023/05/17/Q0iZ2U.png (Reddit)
[1]: https://discord.gg/gjJEfq7ux8
[2]: https://t.me/Microsoft_Activation_Scripts
[3]: https://twitter.com/massgravel
[4]: https://www.reddit.com/r/MAS_Activator
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
---