1
0
mirror of https://github.com/massgravel/Microsoft-Activation-Scripts.git synced 2025-07-05 17:31:20 +01:00

18 Commits

Author SHA1 Message Date
60c99742ce 3.0 2025-02-13 23:10:49 +05:30
8f3f392517 Add updated CAS 2025-02-03 23:57:37 +05:30
af69d79c5c check main domain 2025-02-03 19:32:03 +05:30
63045afc70 Remove activation not required line in HWID 2025-02-02 19:21:01 +05:30
19c6612a47 Optimize the tests 2025-02-02 18:25:46 +05:30
9e6f386819 Fix licensing servers tests 2025-02-02 18:13:28 +05:30
b5ba36c033 Remove UnQuickEdit in check activation script 2025-02-02 03:50:02 +05:30
d10b6d691e Update licensing servers test section 2025-02-01 21:18:21 +05:30
de812acdc5 show error info on screen when unable to connect to licensing servers 2025-01-31 18:25:56 +05:30
75c34cbf50 Add updated CAS by abbodi1406 2025-01-30 02:25:04 +05:30
0d533338a1 Use installed licences edition ids list only from 17063 2025-01-30 02:08:55 +05:30
411f387705 Fix a bug on 7 where it can't list multiple ids 2025-01-30 01:59:45 +05:30
be44b2d887 Don't check tasks if csvlk is installed, don't show wlms in red 2025-01-30 00:51:46 +05:30
0c88f6bc2c Change error detection for ImageState 2025-01-20 22:35:47 +05:30
d31e4ab0cb Remove error variable from non-critical errors 2025-01-17 21:58:29 +05:30
9fd5a661ab Change some variable names 2025-01-17 20:24:54 +05:30
b732e2c8d7 Remove permanent activated IDs check in Office scripts 2025-01-17 17:28:44 +05:30
8e2677b1f9 Check license files instead of folder in change edition 2025-01-17 04:34:03 +05:30
15 changed files with 14541 additions and 985 deletions

6
.gitattributes vendored
View File

@ -1,4 +1,4 @@
# MAS export-ignore
# LICENSE export-ignore
# README.md export-ignore
MAS export-ignore
LICENSE export-ignore
README.md export-ignore
.gitattributes export-ignore

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -161,19 +161,29 @@ for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
call :dk_setvar
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 10240 (
%eline%
echo Unsupported OS version detected [%winbuild%].
echo HWID Activation is only supported on Windows 10/11.
echo:
call :dk_color %Blue% "Use Online KMS activation option."
call :dk_color %Blue% "Use TSforge activation option from the main menu."
goto dk_done
)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
%eline%
echo HWID Activation is not supported on Windows Server.
call :dk_color %Blue% "Use KMS38 or Online KMS activation option."
call :dk_color %Blue% "Use TSforge activation option from the main menu."
goto dk_done
)
@ -294,9 +304,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -312,7 +326,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)
@ -363,7 +377,6 @@ cls
echo ___________________________________________________________________________________________
echo:
call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
call :dk_color2 %_White% " " %Gray% "Activation is not required."
echo ___________________________________________________________________________________________
if %_unattended%==1 goto dk_done
echo:
@ -381,7 +394,8 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2
%eline%
echo [%winos% ^| %winbuild%]
echo:
echo Evaluation editions cannot be activated outside of their evaluation period.
echo Evaluation editions cannot be activated outside of their evaluation period.
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
echo:
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -465,7 +479,7 @@ echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound (
echo This product does not support HWID activation.
echo Make sure you are using the latest version of the script.
echo If you are, then try KMS38 activation option.
echo If you are, then try TSforge activation option from the main menu.
set fixes=%fixes% %mas%
echo %mas%
) else (
@ -605,17 +619,18 @@ goto :dl_final
set "_ident=HKU\S-1-5-19\SOFTWARE\Microsoft\IdentityCRL"
if defined _int (
if %keyerror% EQU 0 if defined _int (
reg delete "%_ident%" /f %nul%
reg query "%_ident%" %nul% && (
echo:
set error=1
call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]"
)
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
call :dk_refresh
call :dk_act
call :dk_checkperm
reg query "%_ident%" %nul% || (
set error=1
echo:
call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%]"
)
)
::==========================================================================================================================================
@ -623,43 +638,40 @@ call :dk_checkperm
:: Extended licensing servers tests incase error not found and activation failed
if %keyerror% EQU 0 if not defined _perm if defined _int (
set resfail=
ipconfig /flushdns %nul%
set "tls=[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;"
for %%# in (
licensing.mp.microsoft.com/v7.0/licenses/content
login.live.com/ppsecure/deviceaddcredential.srf
purchase.mp.microsoft.com/v7.0/users/me/orders
) do if not defined resfail (
set "d1=Add-Type -AssemblyName System.Net.Http;"
set "d1=!d1! $client = [System.Net.Http.HttpClient]::new();"
set "d1=!d1! $response = $client.GetAsync('https://%%#').GetAwaiter().GetResult();"
set "d1=!d1! $response.Content.ReadAsStringAsync().GetAwaiter().GetResult()"
%psc% "!tls! !d1!" %nul2% | findstr /i "PurchaseFD DeviceAddResponse" %nul1% || set resfail=1
%psc% "try { !tls! irm https://%%# -Method POST } catch { if ($_.Exception.Response -eq $null) { Write-Host """"[%%#] $($_.Exception.Message)"""" -ForegroundColor Red -BackgroundColor Black; exit 3 } }"
if !errorlevel!==3 set resfail=1
)
if not defined resfail (
%psc% "!tls! irm https://licensing.mp.microsoft.com/v7.0/licenses/content -Method POST" | find /i "traceId" %nul1% || set resfail=1
)
if defined resfail (
set error=1
echo:
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]"
for %%# in (
live.com
microsoft.com
login.live.com
purchase.mp.microsoft.com
licensing.mp.microsoft.com
) do (
findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [%%# Blocked in Hosts]"
)
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]!hosfail!"
set fixes=%fixes% %mas%licensing-servers-issue
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
)
)
::==========================================================================================================================================
if %keyerror% EQU 0 if not defined _perm if defined _int (
:: Windows update and store block check
reg query "%_ident%" %nul% || (
set error=1
echo:
call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%]"
)
if %keyerror% EQU 0 if not defined _perm if defined _int (
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess %nul2% | find /i "0x1" %nul% && set wublock=1
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DoNotConnectToWindowsUpdateInternetLocations %nul2% | find /i "0x1" %nul% && set wublock=1
@ -684,6 +696,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || (set wuco
)
if defined wucorrupt (
set error=1
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
if !wcount! GTR 2 (
call :dk_color %Red% "Windows seems to be infected with Mal%w%ware."
@ -695,16 +708,21 @@ call :dk_color %Blue% "HWID activation needs working Windows updates, if you hav
) else (
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null"
sc query wuauserv | find /i "RUNNING" %nul% || (
set error=1
set wuerror=1
sc start wuauserv %nul%
call :dk_color %Red% "Starting Windows Update Service [Failed] [!errorlevel!]"
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
)
)
)
REM Check Internet related error codes
::==========================================================================================================================================
if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock (
:: Check Internet related error codes
if %keyerror% EQU 0 if not defined _perm if defined _int (
if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock if not defined resfail (
echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && (
call :dk_color %Red% "Checking Internet Issues [Found] %error_code%"
set fixes=%fixes% %mas%licensing-servers-issue
@ -722,7 +740,7 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
call :dk_color %Red% "Activation Failed %error_code%"
if defined notworking (
call :dk_color %Blue% "At the time of writing, HWID Activation is not supported for this product."
call :dk_color %Blue% "Use KMS38 activation option instead."
call :dk_color %Blue% "Use TSforge activation option from the main menu instead."
) else (
if not defined error call :dk_color %Blue% "%_fixmsg%"
set fixes=%fixes% %mas%troubleshoot
@ -1249,10 +1267,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1
set showfix=1
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set error=1
set showfix=1
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
@ -1281,9 +1299,8 @@ echo Checking WPA Registry Count [%wpainfo%]
)
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
set error=1
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -1305,19 +1322,17 @@ if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined officeact (
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set error=1
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
@ -1348,7 +1363,7 @@ set showfix=1
)
if not defined officeact (
if not defined notwinact (
if %winbuild% GEQ 10240 (
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
set /a "sum/=3"
@ -1381,11 +1396,7 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
@ -1416,7 +1427,6 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
set error=1
)
@ -1462,6 +1472,7 @@ set showfix=1
)
if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
@ -1476,6 +1487,7 @@ set "_notfoundids=Not found"
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -1485,12 +1497,15 @@ call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%toke
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
)
)
)

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -167,15 +167,25 @@ set _k38=
call :dk_setvar
set "specific_kms=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f"
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 14393 (
%eline%
echo Unsupported OS version detected [%winbuild%].
echo KMS38 activation is only supported on Windows 10/11/Server, build 14393 and later.
echo:
if %winbuild% LSS 10240 (
call :dk_color %Blue% "Use Online KMS activation option."
call :dk_color %Blue% "Use TSforge activation option from the main menu."
) else (
call :dk_color %Blue% "Use HWID activation option."
call :dk_color %Blue% "Use HWID activation option from the main menu."
)
goto dk_done
)
@ -297,9 +307,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -315,7 +329,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)
cls
@ -431,7 +445,8 @@ echo Server Evaluation cannot be activated. Convert it to full Server OS.
echo:
call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
) else (
echo Evaluation editions cannot be activated outside of their evaluation period.
echo Evaluation editions cannot be activated outside of their evaluation period.
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
echo:
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -541,7 +556,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
if not defined skunotfound if not defined sppks (
call :dk_color %Red% "This product does not support KMS38 activation."
call :dk_color %Blue% "Make sure you are using the latest version of the script."
call :dk_color %Blue% "Use TSforge activation option from the main menu."
set fixes=%fixes% %mas%
echo %mas%
)
@ -1401,10 +1416,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1
set showfix=1
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set error=1
set showfix=1
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
@ -1433,9 +1448,8 @@ echo Checking WPA Registry Count [%wpainfo%]
)
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
set error=1
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -1457,19 +1471,17 @@ if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined officeact (
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set error=1
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
@ -1500,7 +1512,7 @@ set showfix=1
)
if not defined officeact (
if not defined notwinact (
if %winbuild% GEQ 10240 (
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
set /a "sum/=3"
@ -1533,11 +1545,7 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
@ -1568,7 +1576,6 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
set error=1
)
@ -1614,6 +1621,7 @@ set showfix=1
)
if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
@ -1628,6 +1636,7 @@ set "_notfoundids=Not found"
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -1637,12 +1646,15 @@ call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%toke
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
)
)
)

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -161,6 +161,16 @@ for %%A in (%_act% %_rem%) do (if "%%A"=="1" set _unattended=1)
call :dk_setvar
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 9200 (
%eline%
echo Unsupported OS version detected [%winbuild%].
@ -287,9 +297,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -305,7 +319,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)
cls
@ -400,7 +414,8 @@ set "_serv=sppsvc Winmgmt"
:: Software Protection
:: Windows Management Instrumentation
set officeact=1
set notwinact=1
set ohookact=1
call :dk_errorcheck
:: Check unsupported office versions
@ -495,16 +510,6 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2
::========================================================================================================================================
:: Check already activated products list
set actiProds15=
set actiProds16=
if not "%o15c2r%%o15msi%"=="" call :oh_findactivated -like 15
if not "%o16c2r%%o16msi%"=="" call :oh_findactivated -notlike 16
::========================================================================================================================================
:: Process Office 15.0 C2R
if not defined o15c2r goto :starto16c2r
@ -529,11 +534,11 @@ echo "!_oIds!" | find /i " %%a " %nul1% || (set "_oIds= !_oIds! %%a ")
set "_oLPath=%_oRoot%\Licenses"
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
if "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
if "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
if not "%osarch%"=="x86" (
if "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
if "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
) else (
set "_sppcPath=%SystemRoot%\System32\sppc.dll"
)
@ -579,11 +584,11 @@ set _o16c2rIds=%_oIds%
set "_oLPath=%_oRoot%\Licenses16"
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
if "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
if "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
if not "%osarch%"=="x86" (
if "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
if "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
) else (
set "_sppcPath=%SystemRoot%\System32\sppc.dll"
)
@ -973,11 +978,6 @@ exit /b
for %%# in (%_oIds%) do (
echo: !actiProds%oVer%! | find /i "-%%#-" %nul1% && (
call :dk_color %Gray% "Checking Activation Status [%%# is already permanently activated]"
) || (
set key=
set _actid=
set _lic=
@ -1002,7 +1002,6 @@ set fixes=%fixes% %mas%
call :dk_color %_Yellow% "%mas%"
)
)
)
:: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server
:: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server
@ -1035,11 +1034,11 @@ echo "%2" | find /i "Wow6432Node" %nul1% && set _oArch=x86
if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64
if "%osarch%"=="x86" set _oArch=x86
if "%_oArch%"=="x64" (set "_hookPath=%_oRoot%" & set "_hook=sppc64.dll")
if "%_oArch%"=="x86" (set "_hookPath=%_oRoot%" & set "_hook=sppc32.dll")
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%" & set "_hook=sppc64.dll")
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%" & set "_hook=sppc32.dll")
if not "%osarch%"=="x86" (
if "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
if "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
) else (
set "_sppcPath=%SystemRoot%\System32\sppc.dll"
)
@ -1075,46 +1074,6 @@ exit /b
::========================================================================================================================================
:oh_findactivated
set oVer=%2
set _FsortIds=
set actiProds=
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT LicenseFamily, Name FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL' | Where-Object { $_.Name %1 '*Office 15*' }).LicenseFamily" %nul6%') do call set "actiProds=%%a !actiProds!"
if not defined actiProds exit /b
for %%# in (%actiProds%) do (
set _sortIds=%%#
set _sortIds=!_sortIds:OfficeSPDFreeR_=SPDRetail_!
set _sortIds=!_sortIds:XC2RVL_=XVolume_!
set _sortIds=!_sortIds:CO365R_=Retail_!
set _sortIds=!_sortIds:O365R_=Retail_!
set _sortIds=!_sortIds:E5R_=Retail_!
set _sortIds=!_sortIds:MSDNR_=Retail_!
set _sortIds=!_sortIds:DemoR_=Retail_!
set _sortIds=!_sortIds:EDUR_=Retail_!
set _sortIds=!_sortIds:R_=Retail_!
set _sortIds=!_sortIds:VL_=Volume_!
set _sortIds=!_sortIds:Office16=!
set _sortIds=!_sortIds:Office19=!
set _sortIds=!_sortIds:Office21=!
set _sortIds=!_sortIds:Office24=!
set _sortIds=!_sortIds:Office=!
for /f "tokens=1 delims=-_" %%a in ("!_sortIds!") do set "_sortIds=-%%a-"
set _FsortIds=!_sortIds! !_FsortIds!
)
call :ohookdata findactivated %2
exit /b
:: Below IDs are not checked for permanent activation
set _sortIds=!_sortIds:PreviewVL_=Volume_!
set _sortIds=!_sortIds:PreInstallR_=Retail_!
::========================================================================================================================================
:oh_clearblock
:: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing
@ -1240,7 +1199,7 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
set defname=DEFTEMP-%random%
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
if defined o16c2r if defined officeact (
if defined o16c2r if defined ohookact (
if exist "%defdat%\NTUSER.DAT" (
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
reg query HKU\%defname%\Software %nul% && (
@ -1276,11 +1235,8 @@ set upk_result=0
call :dk_actid 0ff1ce15-a989-479d-af46-f275c6370663
if "%_actprojvis%"=="1" (
set _allactid=
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { $_.LicenseFamily -notmatch 'Project' -and $_.LicenseFamily -notmatch 'Visio' }).ID" %nul6%') do call set "_allactid=%%a !_allactid!"
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { $_.Description -match 'KMSCLIENT' -and ($_.LicenseFamily -match 'Project' -or $_.LicenseFamily -match 'Visio') }).ID" %nul6%') do call set "_allactid=%%a !_allactid!"
) else (
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT ID FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').ID" %nul6%') do call set "_allactid=%%a !_allactid!"
for /f "delims=" %%a in ('%psc% "Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { $_.LicenseFamily -notmatch 'Project' -and $_.LicenseFamily -notmatch 'Visio' } | Select-Object -ExpandProperty ID" %nul6%') do call set "_allactid=%%a !_allactid!"
for /f "delims=" %%a in ('%psc% "Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { '!_allactid!' -contains $_.ID -and ($_.LicenseFamily -match 'Project' -or $_.LicenseFamily -match 'Visio') } | Select-Object -ExpandProperty ID" %nul6%') do call set "_allactid=%%a !_allactid!"
)
for %%# in (%apps%) do (
@ -1298,7 +1254,7 @@ set upk_result=2
)
)
if defined officeact if not %upk_result%==0 echo:
if defined ohookact if not %upk_result%==0 echo:
if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
if %upk_result%==2 call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
exit /b
@ -1730,10 +1686,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1
set showfix=1
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set error=1
set showfix=1
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
@ -1762,9 +1718,8 @@ echo Checking WPA Registry Count [%wpainfo%]
)
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
set error=1
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -1786,19 +1741,17 @@ if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined officeact (
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set error=1
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
@ -1829,7 +1782,7 @@ set showfix=1
)
if not defined officeact (
if not defined notwinact (
if %winbuild% GEQ 10240 (
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
set /a "sum/=3"
@ -1862,11 +1815,7 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
@ -1897,7 +1846,6 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
set error=1
)
@ -1943,6 +1891,7 @@ set showfix=1
)
if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
@ -1957,6 +1906,7 @@ set "_notfoundids=Not found"
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -1966,12 +1916,15 @@ call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%toke
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
)
)
)
@ -2375,12 +2328,6 @@ if defined _oIds (set _oIds=!_oIds! %%E) else (set _oIds=%%E)
)
)
if %1==findactivated if %oVer%==%%A (
echo "!_FsortIds!" | find /i "-%%E-" %nul% && (
set actiProds%oVer%=!actiProds%oVer%! -%%E-
)
)
)
)
exit /b

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -192,6 +192,16 @@ for %%A in (%_actwin% %_actoff% %_actprojvis% %_actwinoff% %_uni%) do (if "%%A"=
call :dk_setvar
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 7600 (
%nceline%
echo Unsupported OS version detected [%winbuild%].
@ -316,9 +326,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -334,7 +348,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)
@ -483,6 +497,7 @@ set "_serv=sppsvc Winmgmt"
:: Software Protection
:: Windows Management Instrumentation
if %_actwin%==0 set notwinact=1
call :dk_errorcheck
::========================================================================================================================================
@ -519,6 +534,7 @@ call :dk_color %Red% "Checking Evaluation Edition [Evaluation editio
if defined _evalserv (
call :dk_color %Blue% "Go back to main menu and use [Change Edition] option."
) else (
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
)
@ -581,10 +597,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
if not defined skunotfound if not defined sppks (
call :dk_color %Red% "This product does not support %KS% activation."
if %winbuild% LSS 9200 (
call :dk_color2 %Blue% "Use the alternative activator listed here - " %_Yellow% " %mas%unsupported_products_activation"
)
set fixes=%fixes% %mas%unsupported_products_activation
call :dk_color %Blue% "Use TSforge activation option from the main menu."
)
echo:
goto :ks_office
@ -1393,7 +1406,7 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
set defname=DEFTEMP-%random%
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
if defined o16c2r if defined officeact (
if defined o16c2r if defined ohookact (
if exist "%defdat%\NTUSER.DAT" (
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
reg query HKU\%defname%\Software %nul% && (
@ -1429,11 +1442,8 @@ set upk_result=0
call :dk_actid 0ff1ce15-a989-479d-af46-f275c6370663
if "%_actprojvis%"=="1" (
set _allactid=
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { $_.LicenseFamily -notmatch 'Project' -and $_.LicenseFamily -notmatch 'Visio' }).ID" %nul6%') do call set "_allactid=%%a !_allactid!"
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { $_.Description -match 'KMSCLIENT' -and ($_.LicenseFamily -match 'Project' -or $_.LicenseFamily -match 'Visio') }).ID" %nul6%') do call set "_allactid=%%a !_allactid!"
) else (
for /f "delims=" %%a in ('%psc% "(Get-WmiObject -Query 'SELECT ID FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND LicenseStatus=1 AND GracePeriodRemaining=0 AND PartialProductKey IS NOT NULL').ID" %nul6%') do call set "_allactid=%%a !_allactid!"
for /f "delims=" %%a in ('%psc% "Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { $_.LicenseFamily -notmatch 'Project' -and $_.LicenseFamily -notmatch 'Visio' } | Select-Object -ExpandProperty ID" %nul6%') do call set "_allactid=%%a !_allactid!"
for /f "delims=" %%a in ('%psc% "Get-WmiObject -Query 'SELECT ID, Description, LicenseFamily FROM %spp% WHERE ApplicationID=''0ff1ce15-a989-479d-af46-f275c6370663'' AND PartialProductKey IS NOT NULL' | Where-Object { '!_allactid!' -contains $_.ID -and ($_.LicenseFamily -match 'Project' -or $_.LicenseFamily -match 'Visio') } | Select-Object -ExpandProperty ID" %nul6%') do call set "_allactid=%%a !_allactid!"
)
for %%# in (%apps%) do (
@ -1451,7 +1461,7 @@ set upk_result=2
)
)
if defined officeact if not %upk_result%==0 echo:
if defined ohookact if not %upk_result%==0 echo:
if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
if %upk_result%==2 call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
exit /b
@ -1830,8 +1840,7 @@ if defined t_name (
echo %prodname% cannot be KMS-activated on this computer due to unqualified OEM BIOS [0xC004F035].
) else (
call :dk_color %Red% "%prodname% cannot be KMS-activated on this computer due to unqualified OEM BIOS [0xC004F035]."
set fixes=%fixes% %mas%unsupported_products_activation
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation"
call :dk_color %Blue% "Use TSforge activation option from the main menu."
)
set oemerr=1
set showfix=1
@ -2831,10 +2840,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1
set showfix=1
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set error=1
set showfix=1
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
@ -2863,9 +2872,8 @@ echo Checking WPA Registry Count [%wpainfo%]
)
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
set error=1
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
@ -2887,19 +2895,17 @@ if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined officeact (
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set error=1
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
@ -2930,7 +2936,7 @@ set showfix=1
)
if not defined officeact (
if not defined notwinact (
if %winbuild% GEQ 10240 (
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
set /a "sum/=3"
@ -2963,11 +2969,7 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
@ -2998,7 +3000,6 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
set error=1
)
@ -3044,6 +3045,7 @@ set showfix=1
)
if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
@ -3058,6 +3060,7 @@ set "_notfoundids=Not found"
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -3067,12 +3070,15 @@ call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%toke
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
)
)
)

View File

@ -1,12 +0,0 @@
--------------------------------------------------------------------------------------
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/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
--------------------------------------------------------------------------------------
Activation Type Supported Product Activation Period
--------------------------------------------------------------------------------------
HWID - Windows 10-11 - Permanent
Ohook - Office - Permanent
TSforge - Windows / ESU / Office - Permanent
KMS38 - Windows 10-11-Server - Till the Year 2038
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
--------------------------------------------------------------------------------------
For more details, check https://massgrave.dev/activations_comparison

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -123,6 +123,16 @@ set "line=echo _________________________________________________________________
::========================================================================================================================================
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 7600 (
%nceline%
echo Unsupported OS version detected [%winbuild%].
@ -247,9 +257,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -265,7 +279,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -128,6 +128,16 @@ set "line=echo _________________________________________________________________
::========================================================================================================================================
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 7600 (
%nceline%
echo Unsupported OS version detected [%winbuild%].
@ -252,9 +262,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -270,7 +284,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)
@ -393,7 +407,7 @@ if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-Ta
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
call :ced_edilist
if %winbuild% GEQ 17063 call :ced_edilist
if /i "%osedition:~0,4%"=="Core" set _pro=Professional
if /i "%osedition%"=="CoreN" set _pro=ProfessionalN
set "_dtarget= %_dtarget% !_wtarget! !_pro! "
@ -506,7 +520,7 @@ set _dismapi=0
:: Check if DISM API or slmgr.vbs is required for edition upgrade
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" (
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\%targetedition%*.xrm-ms" (
echo %_wtarget% | find /i " %targetedition% " || (
set _dismapi=1
)

View File

@ -47,20 +47,40 @@ choice /c 0 /n
exit /b
:sppmgr:
param (
[Parameter()]
[switch]
$All,
[Parameter()]
[switch]
$Dlv,
[Parameter()]
[switch]
$IID,
[Parameter()]
[switch]
$Pass
)
function CONOUT($strObj)
{
Out-Host -Input $strObj
}
function ExitScript($ExitCode = 0)
{
Exit $ExitCode
}
if (-Not $PSVersionTable) {
Write-Host "==== ERROR ====`r`n"
Write-Host 'Windows PowerShell 1.0 is not supported by this script.'
"==== ERROR ====`r`n"
"Windows PowerShell 1.0 is not supported by this script."
ExitScript 1
}
if ($ExecutionContext.SessionState.LanguageMode.value__ -NE 0) {
Write-Host "==== ERROR ====`r`n"
Write-Host 'Windows PowerShell is not running in Full Language Mode.'
"==== ERROR ====`r`n"
"Windows PowerShell is not running in Full Language Mode."
ExitScript 1
}
@ -68,21 +88,34 @@ $winbuild = 1
try {
$winbuild = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:SystemRoot\System32\kernel32.dll").FileBuildPart
} catch {
$winbuild = [int](Get-WmiObject Win32_OperatingSystem).BuildNumber
$winbuild = [int]([wmi]'Win32_OperatingSystem=@').BuildNumber
}
if ($winbuild -EQ 1) {
Write-Host "==== ERROR ====`r`n"
Write-Host 'Could not detect Windows build.'
"==== ERROR ====`r`n"
"Could not detect Windows build."
ExitScript 1
}
if ($winbuild -LT 2600) {
Write-Host "==== ERROR ====`r`n"
Write-Host 'This build of Windows is not supported by this script.'
"==== ERROR ====`r`n"
"This build of Windows is not supported by this script."
ExitScript 1
}
if ($All.IsPresent)
{
$isAll = {CONOUT "`r"}
$noAll = {$null}
}
else
{
$isAll = {$null}
$noAll = {CONOUT "`r"}
}
$Dlv = $Dlv.IsPresent
$IID = $IID.IsPresent -Or $Dlv.IsPresent
$NT6 = $winbuild -GE 6000
$NT7 = $winbuild -GE 7600
$NT9 = $winbuild -GE 9600
@ -94,10 +127,10 @@ $line3 = "____________________________________________________________"
function echoWindows
{
Write-Host "$line2"
Write-Host "=== Windows Status ==="
Write-Host "$line2"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line2"
CONOUT "=== Windows Status ==="
CONOUT "$line2"
& $noAll
}
function echoOffice
@ -106,18 +139,22 @@ function echoOffice
return
}
if ($All.IsPresent) {Write-Host}
Write-Host "$line2"
Write-Host "=== Office Status ==="
Write-Host "$line2"
if (!$All.IsPresent) {Write-Host}
& $isAll
CONOUT "$line2"
CONOUT "=== Office Status ==="
CONOUT "$line2"
& $noAll
$script:doMSG = 0
}
function strGetRegistry($strKey, $strName)
{
Get-ItemProperty -EA 0 $strKey | select -EA 0 -Expand $strName
try {
return [Microsoft.Win32.Registry]::GetValue($strKey, $strName, $null)
} catch {
return $null
}
}
function CheckOhook
@ -148,55 +185,57 @@ function CheckOhook
return
}
if ($All.IsPresent) {Write-Host}
Write-Host "$line2"
Write-Host "=== Office Ohook Status ==="
Write-Host "$line2"
Write-Host
Write-Host -back 'Black' -fore 'Yellow' 'Ohook for permanent Office activation is installed.'
Write-Host -back 'Black' -fore 'Yellow' 'You can ignore the below mentioned Office activation status.'
if (!$All.IsPresent) {Write-Host}
& $isAll
CONOUT "$line2"
CONOUT "=== Office Ohook Status ==="
CONOUT "$line2"
$host.UI.WriteLine('Yellow', 'Black', "`r`nOhook for permanent Office activation is installed.`r`nYou can ignore the below mentioned Office activation status.")
& $noAll
}
#region WMI
function DetectID($strSLP, $strAppId, [ref]$strAppVar)
function DetectID($strSLP, $strAppId)
{
$fltr = "ApplicationID='$strAppId'"
if (!$All.IsPresent) {
$fltr = $fltr + " AND PartialProductKey <> NULL"
}
Get-WmiObject $strSLP ID -Filter $fltr -EA 0 | select ID -EA 0 | foreach {
$strAppVar.Value = 1
}
$ppk = (" AND PartialProductKey <> NULL)", ")")[$All.IsPresent]
$fltr = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId'"
$clause = $fltr + $ppk
$sWmi = [wmisearcher]$clause
$sWmi.Options.Rewindable = $false
return ($sWmi.Get().Count -GT 0)
}
function GetID($strSLP, $strAppId, $strProperty = "ID")
function GetID($strSLP, $strAppId)
{
$NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001)
$IDs = [Collections.ArrayList]@()
$isAdd = (" AND LicenseDependsOn <> NULL)", ")")[$NT5]
$noAdd = " AND LicenseDependsOn IS NULL)"
$query = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId' AND PartialProductKey"
if ($All.IsPresent) {
$fltr = "ApplicationID='$strAppId' AND PartialProductKey IS NULL"
$clause = $fltr
$fltr = $query + " IS NULL"
$clause = $fltr + $isAdd
$sWmi = [wmisearcher]$clause
$sWmi.Options.Rewindable = $false
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
if (-Not $NT5) {
$clause = $fltr + " AND LicenseDependsOn <> NULL"
}
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
if (-Not $NT5) {
$clause = $fltr + " AND LicenseDependsOn IS NULL"
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
$clause = $fltr + $noAdd
$sWmi = [wmisearcher]$clause
$sWmi.Options.Rewindable = $false
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
}
}
$fltr = "ApplicationID='$strAppId' AND PartialProductKey <> NULL"
$clause = $fltr
$fltr = $query + " <> NULL"
$clause = $fltr + $isAdd
$sWmi = [wmisearcher]$clause
$sWmi.Options.Rewindable = $false
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
if (-Not $NT5) {
$clause = $fltr + " AND LicenseDependsOn <> NULL"
}
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
if (-Not $NT5) {
$clause = $fltr + " AND LicenseDependsOn IS NULL"
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
$clause = $fltr + $noAdd
$sWmi = [wmisearcher]$clause
$sWmi.Options.Rewindable = $false
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
}
return $IDs
@ -233,38 +272,45 @@ function DetectSubscription {
if ($objSvc.SubscriptionEdition.Contains("UNKNOWN") -EQ $false) {$SubMsgEdition = $objSvc.SubscriptionEdition}
}
Write-Host
Write-Host "Subscription information:"
Write-Host " Edition: $SubMsgEdition"
Write-Host " Type : $SubMsgType"
Write-Host " Status : $SubMsgStatus"
Write-Host " Expiry : $SubMsgExpiry"
CONOUT "`nSubscription information:"
CONOUT " Edition: $SubMsgEdition"
CONOUT " Type : $SubMsgType"
CONOUT " Status : $SubMsgStatus"
CONOUT " Expiry : $SubMsgExpiry"
}
function DetectAdbaClient
{
CONOUT "`nAD Activation client information:"
CONOUT " Object Name: $ADActivationObjectName"
CONOUT " Domain Name: $ADActivationObjectDN"
CONOUT " CSVLK Extended PID: $ADActivationCsvlkPid"
CONOUT " CSVLK Activation ID: $ADActivationCsvlkSkuId"
}
function DetectAvmClient
{
Write-Host
Write-Host "Automatic VM Activation client information:"
CONOUT "`nAutomatic VM Activation client information:"
if (-Not [String]::IsNullOrEmpty($IAID)) {
Write-Host " Guest IAID: $IAID"
CONOUT " Guest IAID: $IAID"
} else {
Write-Host " Guest IAID: Not Available"
CONOUT " Guest IAID: Not Available"
}
if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostMachineName)) {
Write-Host " Host machine name: $AutomaticVMActivationHostMachineName"
CONOUT " Host machine name: $AutomaticVMActivationHostMachineName"
} else {
Write-Host " Host machine name: Not Available"
CONOUT " Host machine name: Not Available"
}
if ($AutomaticVMActivationLastActivationTime.Substring(0,4) -NE "1601") {
$EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($AutomaticVMActivationLastActivationTime),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt')
Write-Host " Activation time: $EED UTC"
CONOUT " Activation time: $EED UTC"
} else {
Write-Host " Activation time: Not Available"
CONOUT " Activation time: Not Available"
}
if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostDigitalPid2)) {
Write-Host " Host Digital PID2: $AutomaticVMActivationHostDigitalPid2"
CONOUT " Host Digital PID2: $AutomaticVMActivationHostDigitalPid2"
} else {
Write-Host " Host Digital PID2: Not Available"
CONOUT " Host Digital PID2: Not Available"
}
}
@ -294,32 +340,30 @@ function DetectKmsHost
$KeyManagementServiceLowPriority = "Normal"
}
Write-Host
Write-Host "Key Management Service host information:"
Write-Host " Current count: $KeyManagementServiceCurrentCount"
Write-Host " Listening on Port: $KeyManagementServiceListeningPort"
Write-Host " DNS publishing: $KeyManagementServiceDnsPublishing"
Write-Host " KMS priority: $KeyManagementServiceLowPriority"
CONOUT "`nKey Management Service host information:"
CONOUT " Current count: $KeyManagementServiceCurrentCount"
CONOUT " Listening on Port: $KeyManagementServiceListeningPort"
CONOUT " DNS publishing: $KeyManagementServiceDnsPublishing"
CONOUT " KMS priority: $KeyManagementServiceLowPriority"
if (-Not [String]::IsNullOrEmpty($KeyManagementServiceTotalRequests)) {
Write-Host
Write-Host "Key Management Service cumulative requests received from clients:"
Write-Host " Total: $KeyManagementServiceTotalRequests"
Write-Host " Failed: $KeyManagementServiceFailedRequests"
Write-Host " Unlicensed: $KeyManagementServiceUnlicensedRequests"
Write-Host " Licensed: $KeyManagementServiceLicensedRequests"
Write-Host " Initial grace period: $KeyManagementServiceOOBGraceRequests"
Write-Host " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests"
Write-Host " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests"
Write-Host " Notification: $KeyManagementServiceNotificationRequests"
CONOUT "`nKey Management Service cumulative requests received from clients:"
CONOUT " Total: $KeyManagementServiceTotalRequests"
CONOUT " Failed: $KeyManagementServiceFailedRequests"
CONOUT " Unlicensed: $KeyManagementServiceUnlicensedRequests"
CONOUT " Licensed: $KeyManagementServiceLicensedRequests"
CONOUT " Initial grace period: $KeyManagementServiceOOBGraceRequests"
CONOUT " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests"
CONOUT " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests"
if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"}
}
}
function DetectKmsClient
{
if ($null -NE $VLActivationTypeEnabled) {Write-Host "Configured Activation Type: $($VLActTypes[$VLActivationTypeEnabled])"}
Write-Host
if ($null -NE $VLActivationTypeEnabled) {CONOUT "Configured Activation Type: $($VLActTypes[$VLActivationTypeEnabled])"}
CONOUT "`r"
if ($LicenseStatus -NE 1) {
Write-Host "Please activate the product in order to update KMS client information values."
CONOUT "Please activate the product in order to update KMS client information values."
return
}
@ -352,33 +396,42 @@ function DetectKmsClient
}
}
Write-Host "Key Management Service client information:"
Write-Host " Client Machine ID (CMID): $($objSvc.ClientMachineID)"
CONOUT "Key Management Service client information:"
CONOUT " Client Machine ID (CMID): $($objSvc.ClientMachineID)"
if ($null -EQ $KmsReg) {
Write-Host " $KmsDns"
Write-Host " Registered KMS machine name: KMS name not available"
CONOUT " $KmsDns"
CONOUT " Registered KMS machine name: KMS name not available"
} else {
Write-Host " $KmsReg"
CONOUT " $KmsReg"
}
if ($null -NE $DiscoveredKeyManagementServiceMachineIpAddress) {Write-Host " KMS machine IP address: $DiscoveredKeyManagementServiceMachineIpAddress"}
Write-Host " KMS machine extended PID: $KeyManagementServiceProductKeyID"
Write-Host " Activation interval: $VLActivationInterval minutes"
Write-Host " Renewal interval: $VLRenewalInterval minutes"
if ($null -NE $KeyManagementServiceHostCaching) {Write-Host " KMS host caching: $KeyManagementServiceHostCaching"}
if (-Not [String]::IsNullOrEmpty($KeyManagementServiceLookupDomain)) {Write-Host " KMS SRV record lookup domain: $KeyManagementServiceLookupDomain"}
if ($null -NE $DiscoveredKeyManagementServiceMachineIpAddress) {CONOUT " KMS machine IP address: $DiscoveredKeyManagementServiceMachineIpAddress"}
CONOUT " KMS machine extended PID: $KeyManagementServiceProductKeyID"
CONOUT " Activation interval: $VLActivationInterval minutes"
CONOUT " Renewal interval: $VLRenewalInterval minutes"
if ($null -NE $KeyManagementServiceHostCaching) {CONOUT " KMS host caching: $KeyManagementServiceHostCaching"}
if (-Not [String]::IsNullOrEmpty($KeyManagementServiceLookupDomain)) {CONOUT " KMS SRV record lookup domain: $KeyManagementServiceLookupDomain"}
}
function GetResult($strSLP, $strSLS, $strID)
{
try {$objPrd = Get-WmiObject $strSLP -Filter "ID='$strID'" -EA 1} catch {return}
$objPrd | select -Expand Properties -EA 0 | foreach {
if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value}
try
{
$objPrd = [wmisearcher]"SELECT * FROM $strSLP WHERE ID='$strID'"
$objPrd.Options.Rewindable = $false
$objPrd.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value} }
$objPrd.Dispose()
}
catch
{
return
}
$winID = ($ApplicationID -EQ $winApp)
$winPR = ($winID -And -Not $LicenseIsAddon)
$Vista = ($winID -And $NT6 -And -Not $NT7)
$NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001)
$reapp = ("Windows", "App")[!$winID]
$prmnt = ("machine", "product")[!$winPR]
if ($Description | Select-String "VOLUME_KMSCLIENT") {$cKmsClient = 1; $_mTag = "Volume"}
if ($Description | Select-String "TIMEBASED_") {$cTblClient = 1; $_mTag = "Timebased"}
@ -403,7 +456,7 @@ function GetResult($strSLP, $strSLS, $strID)
$LicenseInf = "Licensed"
$LicenseMsg = $null
if ($GracePeriodRemaining -EQ 0) {
if ($winPR) {$ExpireMsg = "The machine is permanently activated."} else {$ExpireMsg = "The product is permanently activated."}
$ExpireMsg = "The $prmnt is permanently activated."
} else {
$LicenseMsg = "$_mTag activation expiration: $GracePeriodRemaining minute(s) ($_gpr day(s))"
if ($null -NE $_xpr) {$ExpireMsg = "$_mTag activation will expire $_xpr"}
@ -424,8 +477,9 @@ function GetResult($strSLP, $strSLS, $strID)
if ($LicenseStatus -EQ 5 -And -Not $NT5) {
$LicenseInf = "Notification"
$LicenseMsg = "Notification Reason: $LicenseReason"
if ($LicenseReason -EQ "0xC004F00F") {if ($null -NE $cKmsClient) {$LicenseMsg = $LicenseMsg + " (KMS license expired)."} else {$LicenseMsg = $LicenseMsg + " (hardware out of tolerance)."}}
if ($LicenseReason -EQ "0xC004F200") {$LicenseMsg = $LicenseMsg + " (non-genuine)."}
if ($LicenseReason -EQ "0xC004F009") {$LicenseMsg = $LicenseMsg + " (grace time expired)."}
if ($LicenseReason -EQ "0xC004F009" -Or $LicenseReason -EQ "0xC004F064") {$LicenseMsg = $LicenseMsg + " (grace time expired)."}
}
if ($LicenseStatus -GT 5 -Or ($LicenseStatus -GT 4 -And $NT5)) {
$LicenseInf = "Unknown"
@ -437,25 +491,61 @@ function GetResult($strSLP, $strSLS, $strID)
}
if ($winPR -And $PartialProductKey -And -Not $NT9) {
$dp4 = Get-ItemProperty -EA 0 "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | select -EA 0 -Expand DigitalProductId4
$dp4 = strGetRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "DigitalProductId4"
if ($null -NE $dp4) {
$ProductKeyChannel = ([System.Text.Encoding]::Unicode.GetString($dp4, 1016, 128)).Trim([char]$null)
}
}
if ($All.IsPresent) {Write-Host}
Write-Host "Name: $Name"
Write-Host "Description: $Description"
Write-Host "Activation ID: $ID"
if ($null -NE $ProductKeyID) {Write-Host "Extended PID: $ProductKeyID"}
if ($null -NE $OfflineInstallationId -And $IID.IsPresent) {Write-Host "Installation ID: $OfflineInstallationId"}
if ($null -NE $ProductKeyChannel) {Write-Host "Product Key Channel: $ProductKeyChannel"}
if ($null -NE $PartialProductKey) {Write-Host "Partial Product Key: $PartialProductKey"} else {Write-Host "Product Key: Not installed"}
Write-Host "License Status: $LicenseInf"
if ($null -NE $LicenseMsg) {Write-Host "$LicenseMsg"}
if ($winPR -And $Dlv -And $NT7 -And $null -EQ $RemainingAppReArmCount) {
try
{
$tmp = [wmisearcher]"SELECT RemainingWindowsReArmCount FROM $strSLS"
$tmp.Options.Rewindable = $false
$tmp.Get() | select -Expand Properties -EA 0 | foreach {set $_.Name $_.Value}
$tmp.Dispose()
}
catch
{
}
}
$add_on = $Name.IndexOf("add-on for", 5)
& $isAll
if ($add_on -EQ -1) {CONOUT "Name: $Name"} else {CONOUT "Name: $($Name.Substring(0, $add_on + 7))"}
CONOUT "Description: $Description"
CONOUT "Activation ID: $ID"
if ($null -NE $ProductKeyID) {CONOUT "Extended PID: $ProductKeyID"}
if ($null -NE $ProductKeyID2 -And $Dlv) {CONOUT "Product ID: $ProductKeyID2"}
if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"}
if ($null -NE $ProductKeyChannel) {CONOUT "Product Key Channel: $ProductKeyChannel"}
if ($null -NE $PartialProductKey) {CONOUT "Partial Product Key: $PartialProductKey"}
CONOUT "License Status: $LicenseInf"
if ($null -NE $LicenseMsg) {CONOUT "$LicenseMsg"}
if ($LicenseStatus -NE 0 -And $EvaluationEndDate.Substring(0,4) -NE "1601") {
$EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($EvaluationEndDate),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt')
Write-Host "Evaluation End Date: $EED UTC"
CONOUT "Evaluation End Date: $EED UTC"
}
if ($Dlv) {
if ($null -NE $RemainingWindowsReArmCount) {
CONOUT "Remaining Windows rearm count: $RemainingWindowsReArmCount"
}
if ($null -NE $RemainingSkuReArmCount -And $RemainingSkuReArmCount -NE 4294967295) {
CONOUT "Remaining $reapp rearm count: $RemainingAppReArmCount"
CONOUT "Remaining SKU rearm count: $RemainingSkuReArmCount"
}
if ($null -NE $TrustedTime -And $LicenseStatus -NE 0) {
$TTD = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($TrustedTime),$null,32).ToString('yyyy-MM-dd hh:mm:ss tt')
CONOUT "Trusted time: $TTD"
}
}
if ($LicenseStatus -EQ 0) {
return
}
if ($strSLP -EQ $wslp -And $null -NE $PartialProductKey -And $null -NE $ADActivationObjectName -And $VLActivationType -EQ 1) {
DetectAdbaClient
}
if ($winID -And $null -NE $cAvmClient -And $null -NE $PartialProductKey) {
@ -467,16 +557,22 @@ function GetResult($strSLP, $strSLS, $strID)
$chkSLS = ($null -NE $PartialProductKey) -And ($null -NE $cKmsClient -Or $null -NE $cKmsHost -Or $chkSub)
if (!$chkSLS) {
if ($null -NE $ExpireMsg) {Write-Host; Write-Host " $ExpireMsg"}
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
return
}
$objSvc = Get-WmiObject $strSLS -EA 0
if ($Vista) {
$objSvc | select -Expand Properties -EA 0 | foreach {
if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value}
}
try
{
$objSvc = New-Object PSObject
$wmiSvc = [wmisearcher]"SELECT * FROM $strSLS"
$wmiSvc.Options.Rewindable = $false
$wmiSvc.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {$objSvc | Add-Member 8 $_.Name $_.Value} }
$wmiSvc.Dispose()
if ($null -EQ $IsKeyManagementServiceMachine) {$objSvc.PSObject.Properties | foreach {set $_.Name $_.Value}}
}
catch
{
return
}
if ($strSLS -EQ $wsls -And $NT9) {
@ -486,6 +582,7 @@ function GetResult($strSLP, $strSLS, $strID)
}
if ($null -NE $cKmsHost -And $IsKeyManagementServiceMachine -GT 0) {
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
DetectKmsHost
}
@ -493,7 +590,9 @@ function GetResult($strSLP, $strSLS, $strID)
DetectKmsClient
}
if ($null -NE $ExpireMsg) {Write-Host; Write-Host " $ExpireMsg"}
if ($null -EQ $cKmsHost) {
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
}
if ($chkSub) {
DetectSubscription
@ -533,11 +632,10 @@ function PrintModePerPridFromRegistry
$vNextPrids = Get-Item -Path $vNextRegkey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'property' -ErrorAction SilentlyContinue | Where-Object -FilterScript {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}
If ($null -Eq $vNextPrids)
{
Write-Host
Write-Host "No registry keys found."
CONOUT "`nNo registry keys found."
Return
}
Write-Host
CONOUT "`r"
$vNextPrids | ForEach `
{
$mode = (Get-ItemProperty -Path $vNextRegkey -Name $_).$_
@ -547,7 +645,7 @@ function PrintModePerPridFromRegistry
3 { $mode = "Device"; Break }
Default { $mode = "Legacy"; Break }
}
Write-Host $_ = $mode
CONOUT "$_ = $mode"
}
}
@ -561,8 +659,7 @@ function PrintSharedComputerLicensing
$scaPolicyValue = Get-ItemProperty -Path $scaPolicyKey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction SilentlyContinue
If ($null -Eq $scaValue -And $null -Eq $scaValue2 -And $null -Eq $scaPolicyValue)
{
Write-Host
Write-Host "No registry keys found."
CONOUT "`nNo registry keys found."
Return
}
$scaModeValue = $scaValue -Or $scaValue2 -Or $scaPolicyValue
@ -574,23 +671,17 @@ function PrintSharedComputerLicensing
{
$scaMode = "Enabled"
}
Write-Host
Write-Host "Status:" $scaMode
Write-Host
CONOUT "`nStatus: $scaMode"
CONOUT "`r"
$tokenFiles = $null
$tokenPath = "${env:LOCALAPPDATA}\Microsoft\Office\16.0\Licensing"
If (Test-Path $tokenPath)
{
$tokenFiles = Get-ChildItem -Path $tokenPath -Filter "*authString*" -Recurse | Where-Object { !$_.PSIsContainer }
}
If ($null -Eq $tokenFiles)
If ($null -Eq $tokenFiles -Or $tokenFiles.Length -Eq 0)
{
Write-Host "No tokens found."
Return
}
If ($tokenFiles.Length -Eq 0)
{
Write-Host "No tokens found."
CONOUT "No tokens found."
Return
}
$tokenFiles | ForEach `
@ -624,16 +715,9 @@ function PrintLicensesInformation
{
$licenseFiles = Get-ChildItem -Path $licensePath -Recurse | Where-Object { !$_.PSIsContainer }
}
If ($null -Eq $licenseFiles)
If ($null -Eq $licenseFiles -Or $licenseFiles.Length -Eq 0)
{
Write-Host
Write-Host "No licenses found."
Return
}
If ($licenseFiles.Length -Eq 0)
{
Write-Host
Write-Host "No licenses found."
CONOUT "`nNo licenses found."
Return
}
$licenseFiles | ForEach `
@ -690,24 +774,20 @@ function vNextDiagRun
Return
}
if ($All.IsPresent) {Write-Host}
Write-Host "$line2"
Write-Host "=== Office vNext Status ==="
Write-Host "$line2"
Write-Host
Write-Host "========== Mode per ProductReleaseId =========="
& $isAll
CONOUT "$line2"
CONOUT "=== Office vNext Status ==="
CONOUT "$line2"
CONOUT "`n========== Mode per ProductReleaseId =========="
PrintModePerPridFromRegistry
Write-Host
Write-Host "========== Shared Computer Licensing =========="
CONOUT "`n========== Shared Computer Licensing =========="
PrintSharedComputerLicensing
Write-Host
Write-Host "========== vNext licenses ==========="
CONOUT "`n========== vNext licenses ==========="
PrintLicensesInformation -Mode "NUL"
Write-Host
Write-Host "========== Device licenses =========="
CONOUT "`n========== Device licenses =========="
PrintLicensesInformation -Mode "Device"
Write-Host "$line3"
Write-Host
CONOUT "$line3"
CONOUT "`r"
}
#endregion
@ -790,13 +870,13 @@ function PrintStateData {
}
[string[]]$pwszStateString = $Marshal::PtrToStringUni($pwszStateData) -replace ";", "`n "
Write-Host " $pwszStateString"
CONOUT (" $pwszStateString")
$Marshal::FreeHGlobal($pwszStateData)
return $TRUE
}
function PrintLastActivationHRresult {
function PrintLastActivationHResult {
$pdwLastHResult = 0
$cbSize = 0
@ -809,12 +889,34 @@ function PrintLastActivationHRresult {
return $FALSE
}
Write-Host (" LastActivationHResult=0x{0:x8}" -f $Marshal::ReadInt32($pdwLastHResult))
CONOUT (" LastActivationHResult=0x{0:x8}" -f $Marshal::ReadInt32($pdwLastHResult))
$Marshal::FreeHGlobal($pdwLastHResult)
return $TRUE
}
function PrintLastActivationTime {
$pdwLastTime = 0
$cbSize = 0
if ($Win32::SLGetWindowsInformation(
"Security-SPP-LastWindowsActivationTime",
[ref]$null,
[ref]$cbSize,
[ref]$pdwLastTime
)) {
return $FALSE
}
$actTime = $Marshal::ReadInt64($pdwLastTime)
if ($actTime -ne 0) {
CONOUT (" LastActivationTime={0}" -f [DateTime]::FromFileTimeUtc($actTime).ToString("yyyy/MM/dd:HH:mm:ss"))
}
$Marshal::FreeHGlobal($pdwLastTime)
return $TRUE
}
function PrintIsWindowsGenuine {
$dwGenuine = 0
$ppwszGenuineStates = @(
@ -830,9 +932,9 @@ function PrintIsWindowsGenuine {
}
if ($dwGenuine -lt 5) {
Write-Host (" IsWindowsGenuine={0}" -f $ppwszGenuineStates[$dwGenuine])
CONOUT (" IsWindowsGenuine={0}" -f $ppwszGenuineStates[$dwGenuine])
} else {
Write-Host (" IsWindowsGenuine={0}" -f $dwGenuine)
CONOUT (" IsWindowsGenuine={0}" -f $dwGenuine)
}
return $TRUE
@ -856,7 +958,7 @@ function PrintDigitalLicenseStatus {
[bool]$bDigitalLicense = $FALSE
$bDigitalLicense = (($dwReturnCode -ge 0) -and ($dwReturnCode -ne 1))
Write-Host (" IsDigitalLicense={0}" -f (BoolToWStr $bDigitalLicense))
CONOUT (" IsDigitalLicense={0}" -f (BoolToWStr $bDigitalLicense))
return $TRUE
}
@ -874,7 +976,7 @@ function PrintSubscriptionStatus {
return $FALSE
}
Write-Host (" SubscriptionSupportedEdition={0}" -f (BoolToWStr $dwSupported))
CONOUT (" SubscriptionSupportedEdition={0}" -f (BoolToWStr $dwSupported))
$pStatus = $Marshal::AllocHGlobal($Marshal::SizeOf([Type]$SubStatus))
if ($Win32::ClipGetSubscriptionStatus([ref]$pStatus)) {
@ -885,25 +987,26 @@ function PrintSubscriptionStatus {
$sStatus = $Marshal::PtrToStructure($pStatus, [Type]$SubStatus)
$Marshal::FreeHGlobal($pStatus)
Write-Host (" SubscriptionEnabled={0}" -f (BoolToWStr $sStatus.dwEnabled))
CONOUT (" SubscriptionEnabled={0}" -f (BoolToWStr $sStatus.dwEnabled))
if ($sStatus.dwEnabled -eq 0) {
return $TRUE
}
Write-Host (" SubscriptionSku={0}" -f $sStatus.dwSku)
Write-Host (" SubscriptionState={0}" -f $sStatus.dwState)
CONOUT (" SubscriptionSku={0}" -f $sStatus.dwSku)
CONOUT (" SubscriptionState={0}" -f $sStatus.dwState)
return $TRUE
}
function ClicRun
{
if ($All.IsPresent) {Write-Host}
Write-Host "Client Licensing Check information:"
& $isAll
CONOUT "Client Licensing Check information:"
$null = PrintStateData
$null = PrintLastActivationHRresult
$null = PrintLastActivationHResult
$null = PrintLastActivationTime
$null = PrintIsWindowsGenuine
if ($DllDigital) {
@ -914,15 +1017,15 @@ function ClicRun
$null = PrintSubscriptionStatus
}
Write-Host "$line3"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line3"
& $noAll
}
#endregion
$Host.UI.RawUI.WindowTitle = "Check Activation Status"
if ($All.IsPresent) {
$B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B;clear;
$B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B;
if (!$Pass.IsPresent) {clear;}
}
$SysPath = "$env:SystemRoot\System32"
@ -941,46 +1044,43 @@ $cSub = ($winbuild -GE 19041) -And (Select-String -Path "$SysPath\wbem\sppwmi.mo
$DllDigital = ($winbuild -GE 14393) -And (Test-Path "$SysPath\EditionUpgradeManagerObj.dll")
$DllSubscription = ($winbuild -GE 14393) -And (Test-Path "$SysPath\Clipc.dll")
$VLActTypes = @("All", "AD", "KMS", "Token")
$SLKeyPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
$NSKeyPath = "Registry::HKEY_USERS\S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
$SLKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
$NSKeyPath = "HKEY_USERS\S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ $null}
'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ $false}
$OsppHook = 1
try {gsv osppsvc -EA 1 | Out-Null} catch {$OsppHook = 0}
$offsvc = "osppsvc"
if ($NT7 -Or -Not $NT6) {$winsvc = "sppsvc"} else {$winsvc = "slsvc"}
if ($NT7 -Or -Not $NT6) {
try {sasv sppsvc -EA 1} catch {}
try {gsv $winsvc -EA 1 | Out-Null; $WsppHook = 1} catch {$WsppHook = 0}
try {gsv $offsvc -EA 1 | Out-Null; $OsppHook = 1} catch {$OsppHook = 0}
if ($WsppHook -NE 0) {
try {sasv $winsvc -EA 1} catch {}
$cW1nd0ws = DetectID $wslp $winApp
$c0ff1ce15 = DetectID $wslp $o15App
$c0ff1ce14 = DetectID $wslp $o14App
}
else
{
try {sasv slsvc -EA 1} catch {}
}
DetectID $wslp $winApp ([ref]$cW1nd0ws)
DetectID $wslp $o15App ([ref]$c0ff1ce15)
DetectID $wslp $o14App ([ref]$c0ff1ce14)
if ($OsppHook -NE 0) {
try {sasv osppsvc -EA 1} catch {}
DetectID $oslp $o15App ([ref]$ospp15)
DetectID $oslp $o14App ([ref]$ospp14)
try {sasv $offsvc -EA 1} catch {}
$ospp15 = DetectID $oslp $o15App
$ospp14 = DetectID $oslp $o14App
}
if ($null -NE $cW1nd0ws)
if ($cW1nd0ws)
{
echoWindows
GetID $wslp $winApp | foreach -EA 1 {
GetResult $wslp $wsls $_
Write-Host "$line3"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line3"
& $noAll
}
}
elseif ($NT6)
{
echoWindows
Write-Host
Write-Host "Error: product key not found."
CONOUT "`nError: product key not found."
}
if ($winbuild -GE 9200) {
@ -994,39 +1094,43 @@ if ($c0ff1ce15 -Or $ospp15) {
$doMSG = 1
if ($null -NE $c0ff1ce15) {
if ($c0ff1ce15)
{
echoOffice
GetID $wslp $o15App | foreach -EA 1 {
GetResult $wslp $wsls $_
Write-Host "$line3"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line3"
& $noAll
}
}
if ($null -NE $c0ff1ce14) {
if ($c0ff1ce14)
{
echoOffice
GetID $wslp $o14App | foreach -EA 1 {
GetResult $wslp $wsls $_
Write-Host "$line3"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line3"
& $noAll
}
}
if ($null -NE $ospp15) {
if ($ospp15)
{
echoOffice
GetID $oslp $o15App | foreach -EA 1 {
GetResult $oslp $osls $_
Write-Host "$line3"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line3"
& $noAll
}
}
if ($null -NE $ospp14) {
if ($ospp14)
{
echoOffice
GetID $oslp $o14App | foreach -EA 1 {
GetResult $oslp $osls $_
Write-Host "$line3"
if (!$All.IsPresent) {Write-Host}
CONOUT "$line3"
& $noAll
}
}

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -122,6 +122,16 @@ call :dk_setvar
::========================================================================================================================================
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 7600 (
%nceline%
echo Unsupported OS version detected [%winbuild%].
@ -246,9 +256,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -264,7 +278,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)
@ -305,6 +319,7 @@ 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_AIO.cmd=Activators\Ohook_Activation_AIO.cmd
set TSforge_Activation.cmd=Activators\TSforge_Activation.cmd
pushd "!_work!"
set _nofile=
@ -313,6 +328,7 @@ for %%# in (
%KMS38_Activation.cmd%
%Online_KMS_Activation.cmd%
%Ohook_Activation_AIO.cmd%
%TSforge_Activation.cmd%
) do (
if not exist "%%#" set _nofile=1
)
@ -338,36 +354,34 @@ echo:
echo:
echo:
echo: Extract $OEM$ folder on the desktop
echo: ________________________________________________________
echo: ____________________________________________________________
echo:
echo: [1] HWID
echo: [2] Ohook
echo: [3] KMS38
echo: [4] Online KMS
echo: [1] HWID [Windows]
echo: [2] Ohook [Office]
echo: [3] TSforge [Windows / ESU / Office]
echo: [4] KMS38 [Windows]
echo: [5] Online KMS [Windows / Office]
echo:
echo: [5] HWID ^(Windows^) ^+ Ohook ^(Office^)
echo: [6] HWID ^(Windows^) ^+ Online KMS ^(Office^)
echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^)
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
echo: [6] HWID [Windows] ^+ Ohook [Office]
echo: [7] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
echo: [8] TSforge [Windows] ^+ Online KMS [Office]
echo:
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
echo: [0] Exit
echo: ________________________________________________________
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
echo: [0] Exit
echo: ____________________________________________________________
echo:
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
choice /C:123456789R0 /N
choice /C:12345678R0 /N
set _erl=%errorlevel%
if %_erl%==11 exit /b
if %_erl%==10 start %mas%oem-folder &goto :Menu
if %_erl%==9 goto:kms_ohook
if %_erl%==8 goto:kms38_kms
if %_erl%==7 goto:kms38_ohook
if %_erl%==6 goto:hwid_kms
if %_erl%==5 goto:hwid_ohook
if %_erl%==4 goto:kms
if %_erl%==3 goto:kms38
if %_erl%==10 exit /b
if %_erl%==9 start %mas%oem-folder &goto :Menu
if %_erl%==8 goto:tsforge_kms
if %_erl%==7 goto:hwid_ohook_tsforge
if %_erl%==6 goto:hwid_ohook
if %_erl%==5 goto:kms
if %_erl%==4 goto:kms38
if %_erl%==3 goto:tsforge
if %_erl%==2 goto:ohook
if %_erl%==1 goto:hwid
goto :Menu
@ -434,6 +448,36 @@ cd \
::========================================================================================================================================
:tsforge
cls
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
popd
call :export tsforge_setup
set _error=
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
set oem=TSforge
goto done
:tsforge_setup:
@echo off
fltmc >nul || exit /b
call "%~dp0TSforge_Activation.cmd" /Z-WindowsESUOffice
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:tsforge_setup:
::========================================================================================================================================
:kms38
cls
@ -532,26 +576,28 @@ cd \
::========================================================================================================================================
:hwid_kms
:hwid_ohook_tsforge
cls
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
popd
call :export hwid_kms_setup
call :export hwid_ohook_tsforge_setup
set _error=
if not exist "!_dir!\HWID_Activation.cmd" set _error=1
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
set oem=HWID [Windows] + Online KMS [Office]
set oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]
goto done
:hwid_kms_setup:
:hwid_ohook_tsforge_setup:
@echo off
fltmc >nul || exit /b
@ -560,80 +606,46 @@ setlocal
call "%~dp0HWID_Activation.cmd" /HWID
endlocal
setlocal
call "%~dp0Online_KMS_Activation.cmd" /K-Office
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:hwid_kms_setup:
::========================================================================================================================================
:kms38_ohook
cls
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %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_AIO.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
set oem=KMS38 [Windows] + Ohook [Office]
goto done
:kms38_ohook_setup:
@echo off
fltmc >nul || exit /b
setlocal
call "%~dp0KMS38_Activation.cmd" /KMS38
endlocal
setlocal
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
endlocal
setlocal
call "%~dp0TSforge_Activation.cmd" /Z-ESU
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:kms38_ohook_setup:
:hwid_ohook_tsforge_setup:
::========================================================================================================================================
:kms38_kms
:tsforge_kms
cls
md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!"
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %nul%
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
popd
call :export kms38_kms_setup
call :export tsforge_kms_setup
set _error=
if not exist "!_dir!\KMS38_Activation.cmd" set _error=1
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
set oem=KMS38 [Windows] + Online KMS [Office]
set oem=TSforge [Windows] + Online KMS [Office]
goto done
:kms38_kms_setup:
:tsforge_kms_setup:
@echo off
fltmc >nul || exit /b
setlocal
call "%~dp0KMS38_Activation.cmd" /KMS38
call "%~dp0TSforge_Activation.cmd" /Z-Windows
endlocal
setlocal
@ -642,45 +654,7 @@ endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:kms38_kms_setup:
::========================================================================================================================================
:kms_ohook
cls
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_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_AIO.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound
set oem=Online KMS [Windows] + Ohook [Office]
goto done
:kms_ohook_setup:
@echo off
fltmc >nul || exit /b
setlocal
call "%~dp0Online_KMS_Activation.cmd" /K-Windows
endlocal
setlocal
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
endlocal
cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:kms_ohook_setup:
:tsforge_kms_setup:
::========================================================================================================================================
@ -698,7 +672,7 @@ call :dk_color %Blue% "%oem%"
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
echo "%oem%" | find /i "38" %nul% && (
echo:
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
echo To KMS38 activate Server Cor/Acor editions [No GUI Versions],
echo Check this page %mas%oem-folder
)
echo ______________________________________________________________

View File

@ -1,4 +1,4 @@
@set masver=2.9
@set masver=3.0
@echo off
@ -123,6 +123,16 @@ set "line=______________________________________________________________________
::========================================================================================================================================
if %winbuild% EQU 1 (
%eline%
echo Failed to detect Windows build number.
echo:
setlocal EnableDelayedExpansion
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
if %winbuild% LSS 7600 (
%nceline%
echo Unsupported OS version detected [%winbuild%].
@ -247,9 +257,13 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -=
set old=
set upver=%masver:.=%
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))
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
if not "%%#"=="" set old=1
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
if not "%%#"=="" set old=
)
)
if defined old (
@ -265,7 +279,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your 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)
if !errorlevel!==1 (start %mas% & exit /b)
)
)

View File

@ -2,7 +2,7 @@
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
<hr>
@ -15,19 +15,12 @@
```
irm https://get.activated.win | iex
```
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
4. That's all.
<details>
<summary>More options</summary>
- Alternatively, you can use the following (It will be deprecated in the future.)
Alternatively, you can use the following (It will be deprecated in the future.)
```
irm https://massgrave.dev/get | iex
```
- The URL `get.activated.win` might be blocked by some DNS services because it is a new domain.
</details>
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
4. That's all.
---
@ -50,6 +43,14 @@ or
---
### Not working ❓
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
---
> [!NOTE]
>
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
@ -61,8 +62,8 @@ or
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
```
Latest Version: 2.9
Release date: 20-Dec-2024
Latest Version: 3.0
Release date: 14-Feb-2025
```
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)