1
0
mirror of https://github.com/massgravel/Microsoft-Activation-Scripts.git synced 2025-02-19 20:18:34 +00:00

65 Commits

Author SHA1 Message Date
WindowsAddict
60c99742ce 3.0 2025-02-13 23:10:49 +05:30
WindowsAddict
8f3f392517 Add updated CAS 2025-02-03 23:57:37 +05:30
WindowsAddict
af69d79c5c check main domain 2025-02-03 19:32:03 +05:30
WindowsAddict
63045afc70 Remove activation not required line in HWID 2025-02-02 19:21:01 +05:30
WindowsAddict
19c6612a47 Optimize the tests 2025-02-02 18:25:46 +05:30
WindowsAddict
9e6f386819 Fix licensing servers tests 2025-02-02 18:13:28 +05:30
WindowsAddict
b5ba36c033 Remove UnQuickEdit in check activation script 2025-02-02 03:50:02 +05:30
WindowsAddict
d10b6d691e Update licensing servers test section 2025-02-01 21:18:21 +05:30
WindowsAddict
de812acdc5 show error info on screen when unable to connect to licensing servers 2025-01-31 18:25:56 +05:30
WindowsAddict
75c34cbf50 Add updated CAS by abbodi1406 2025-01-30 02:25:04 +05:30
WindowsAddict
0d533338a1 Use installed licences edition ids list only from 17063 2025-01-30 02:08:55 +05:30
WindowsAddict
411f387705 Fix a bug on 7 where it can't list multiple ids 2025-01-30 01:59:45 +05:30
WindowsAddict
be44b2d887 Don't check tasks if csvlk is installed, don't show wlms in red 2025-01-30 00:51:46 +05:30
WindowsAddict
0c88f6bc2c Change error detection for ImageState 2025-01-20 22:35:47 +05:30
WindowsAddict
d31e4ab0cb Remove error variable from non-critical errors 2025-01-17 21:58:29 +05:30
WindowsAddict
9fd5a661ab Change some variable names 2025-01-17 20:24:54 +05:30
WindowsAddict
b732e2c8d7 Remove permanent activated IDs check in Office scripts 2025-01-17 17:28:44 +05:30
WindowsAddict
8e2677b1f9 Check license files instead of folder in change edition 2025-01-17 04:34:03 +05:30
WindowsAddict
f2e40bf88e Fix an issue where the script doesn't show fix licensing suggestion 2025-01-09 00:44:02 +05:30
WindowsAddict
a4f9b219ab Change wordings 2025-01-09 00:21:13 +05:30
WindowsAddict
7262a44ba2 Add obscure product keys 2024-12-21 21:15:21 +05:30
WindowsAddict
37ec96504a Fix registry count 2024-12-21 15:48:02 +05:30
WindowsAddict
051b4f673f Revert export-ignore 2024-12-21 04:37:12 +05:30
WindowsAddict
3ef6d7292e export-ignore 2024-12-21 04:32:25 +05:30
WindowsAddict
0d9ffd2052 2.9 2024-12-21 04:22:05 +05:30
WindowsAddict
9f00df5aee Add a link for service fix 2024-12-21 01:21:27 +05:30
WindowsAddict
d6aa8b97d1 Show update related troubleshooting when activation fails 2024-12-20 21:04:56 +05:30
WindowsAddict
c00b076a86 change label name 2024-12-20 19:57:08 +05:30
WindowsAddict
8fff2ccb9c Check all act ids for errors instead of installed key's act id 2024-12-20 17:59:19 +05:30
WindowsAddict
5638898eaf Update license cleanup 2024-12-20 17:19:35 +05:30
WindowsAddict
22ed7a7a07 Update subscription editon keys 2024-12-20 16:49:21 +05:30
WindowsAddict
f1ddb83df0 Update link in read me 2024-11-11 14:28:28 +05:30
WindowsAddict
4dd0215ccc Remove the box 2024-11-10 16:31:18 +05:30
WindowsAddict
ec259dfbd7 Fix a typo 2024-11-10 00:47:15 +05:30
WindowsAddict
bbdc9bdfd8 Revert export-ignore 2024-11-09 21:52:43 +05:30
WindowsAddict
7d036f57fd Export-ignore 2024-11-09 21:50:23 +05:30
WindowsAddict
ab90514b0a 2.8 2024-11-09 21:13:50 +05:30
WindowsAddict
25abc1f457 Don't show other fixes when HKU\S-1-5-20 is missing 2024-11-09 20:42:20 +05:30
WindowsAddict
873c4bc4d8 Detect a potential script crash when user installs too many licenses for Office 2024-11-09 20:35:41 +05:30
WindowsAddict
0b402d9afe Update readme 2024-11-09 05:54:18 +05:30
WindowsAddict
5141866f0a Update ReadMe 2024-11-09 05:49:07 +05:30
WindowsAddict
f0618824a4 Get edition ID from WMI 2024-11-09 05:40:56 +05:30
WindowsAddict
03cc88193d Fix an issue in edition list when Windows sub license is present 2024-11-09 04:25:44 +05:30
WindowsAddict
897a9db808 Suggest repair_upgrade for HKU\S-1-5-20 error 2024-11-09 02:43:31 +05:30
WindowsAddict
9bbd02cc91 Update PUP detection 2024-11-08 22:16:51 +05:30
WindowsAddict
d1dca45710 Update ReadMe 2024-11-08 21:06:48 +05:30
WindowsAddict
5e71252993 Change DarkRed to Red 2024-11-08 20:10:19 +05:30
WindowsAddict
1db017f1f1 Better info when key is not found 2024-11-08 19:59:34 +05:30
WindowsAddict
d06ba7fc4c Show info to read blue lines 2024-11-08 05:21:08 +05:30
WindowsAddict
99954a9056 Add troubleshooting info for IMAGE_STATE_UNDEPLOYABLE 2024-11-08 02:35:41 +05:30
WindowsAddict
fcb710a48a Add an error code to detect WMI error 2024-11-05 22:23:02 +05:30
WindowsAddict
0cbaa141c3 Update keys 2024-11-05 17:43:20 +05:30
WindowsAddict
9d1964ceda Increase time out 2024-11-03 08:31:56 +05:30
WindowsAddict
0477cf13e1 Fix repair setup detection on W10 ARM64 2024-11-03 06:18:19 +05:30
WindowsAddict
9b568d4b4e Mention all W10 keys in change edition because of issues with x86PS / pkeyhelper.dll on W10 ARM64 2024-11-03 05:45:45 +05:30
WindowsAddict
1c9fe0815e Bug fix - Add a missing label in change edition section in AIO 2024-11-03 05:01:19 +05:30
WindowsAddict
a5dd99ac00 Show info when latest office products are not in the list 2024-11-03 02:32:03 +05:30
WindowsAddict
1849dd3075 Show 3rd party AV list when Powershell check fails 2024-10-31 06:00:02 +05:30
WindowsAddict
8fe0b24945 Fix a bug
Thanks to abbodi1406 for notifying
2024-10-30 20:19:09 +05:30
WindowsAddict
7c69c471c5 Fix bugs due to x86 Powershell (No ARM64/x64) on Windows 10 ARM64 2024-10-30 10:29:31 +05:30
WindowsAddict
f32cb934dc Remove W7 Embedded Standard activation with Volume:BA
Even though it reports its activated, its wlms service doesn't accept it and the system gets shutdown after 1 hour
2024-10-28 12:18:04 +05:30
WindowsAddict
7a6e63a462 Improve WLMS service check 2024-10-28 12:09:40 +05:30
WindowsAddict
d76b2ea57e Remove update registry check in malware detection 2024-10-28 12:00:30 +05:30
WindowsAddict
1f0e04519a Add support for UWP Office activation in Online KMS 2024-10-28 11:09:59 +05:30
WindowsAddict
d059952ecd Improve SID detection in uninstall section 2024-10-25 05:59:10 +05:30
15 changed files with 15556 additions and 1430 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.7
@set masver=3.0
@echo off
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -107,7 +109,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -143,6 +145,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="/HWID" set _act=1
@ -157,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
)
@ -207,15 +221,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -263,6 +278,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -288,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 (
@ -306,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)
)
)
@ -357,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:
@ -375,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"
@ -459,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 (
@ -537,7 +557,7 @@ echo Generating GenuineTicket.xml [Successful]
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
%_xmlexist% (
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
%_xmlexist% timeout /t 2 %nul%
%_xmlexist% timeout /t 2 %nul%
@ -599,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 10 | Out-Null")
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%]"
)
)
::==========================================================================================================================================
@ -617,75 +638,91 @@ 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"
)
::==========================================================================================================================================
:: Windows update and store block check
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
if defined wublock (
call :dk_color %Red% "Checking Update Blocker In Registry [Found]"
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
)
reg query "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v DisableStoreApps %nul2% | find /i "0x1" %nul% && (
set storeblock=1
call :dk_color %Red% "Checking Store Blocker In Registry [Found]"
call :dk_color %Blue% "If you have used any tool to block Store, undo it."
)
set wcount=0
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type ServiceSidType RequiredPrivileges FailureActions) do (
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv /v %%G %nul% || (set wucorrupt=1&set /a wcount+=1)
)
for %%G in (Parameters Security) do (
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || (set wucorrupt=1&set /a wcount+=1)
)
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."
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
) else (
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
)
) 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."
)
)
)
::==========================================================================================================================================
:: Check Internet related error codes
if %keyerror% EQU 0 if not defined _perm if defined _int (
reg query "%_ident%" %nul% || (
set error=1
echo:
call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%]"
)
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
if defined wublock call :dk_color %Red% "Checking Update Blocker In Registry [Found]"
reg query "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v DisableStoreApps %nul2% | find /i "0x1" %nul% && (
set storeblock=1
call :dk_color %Red% "Checking Store Blocker In Registry [Found]"
)
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type ServiceSidType RequiredPrivileges FailureActions) do if not defined wucorrupt (
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv /v %%G %nul% || set wucorrupt=1
)
for %%G in (Parameters Security TriggerInfo) do if not defined wucorrupt (
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || set wucorrupt=1
)
if defined wucorrupt (
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
) else (
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 10 | Out-Null"
sc query wuauserv | find /i "RUNNING" %nul% || (
set wuerror=1
sc start wuauserv %nul%
call :dk_color %Red% "Starting Windows Update Service [Failed] [!errorlevel!]"
)
)
REM Check Internet related error codes
if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock (
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
@ -703,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
@ -749,12 +786,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -764,6 +804,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
@ -940,7 +981,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
exit /b
:: Get Activation IDs from licensing files if not found through WMI
@ -1009,7 +1050,7 @@ echo sc start sppsvc [Error Code: %spperror%]
)
echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -1063,26 +1104,16 @@ exit /b
set w=
set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
set pupfound=%pupfound1%%pupfound2%
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
if not defined pupfound (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
)
set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0
for %%# in (wuauserv) do (
set _corrupt=
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
)
)
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]"
@ -1098,6 +1129,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
)
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
if exist %SysPath%\Tasks\R@1n-KMS (
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
)
exit /b
::========================================================================================================================================
@ -1189,7 +1227,7 @@ set errorcode=
set checkerror=
sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
)
@ -1206,6 +1244,11 @@ echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
set showfix=1
)
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
set showfix=1
)
)
::========================================================================================================================================
@ -1219,7 +1262,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
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" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
@ -1227,6 +1273,10 @@ 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% && (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
)
@ -1249,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"
@ -1260,7 +1309,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -1269,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%]"
)
)
@ -1303,7 +1354,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed (
set error=1
call :dk_color %Red% "Checking WMI [Not Working]"
@ -1312,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"
@ -1345,21 +1396,16 @@ 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" (
sc query wlms | find /i "RUNNING" %nul% && (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
@ -1380,15 +1426,14 @@ echo Checking SPP In IFEO [%_sppint%]
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
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 10 | Out-Null"
set error=1
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1
set showfix=1
)
@ -1427,20 +1472,22 @@ 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 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
%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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found"
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
set error=1
set "_notfoundids=Not found"
)
set error=1
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -1450,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."
)
)
)
@ -1463,7 +1513,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror=
if %winbuild% GEQ 9200 (
if %winbuild% GEQ 9200 if not defined ps32onArm (
for %%# in (
"%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -1597,6 +1647,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))

View File

@ -1,4 +1,4 @@
@set masver=2.7
@set masver=3.0
@echo off
@ -47,26 +47,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -110,7 +112,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -146,6 +148,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="/KMS38" set _act=1
@ -163,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
)
@ -210,15 +224,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -266,6 +281,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -291,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 (
@ -309,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
@ -425,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"
@ -516,18 +537,29 @@ call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Acti
)
if not defined key if not defined _gvlk (
%eline%
echo:
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound (
echo This product does not support KMS38 activation.
echo Make sure you are using the latest version of the script.
set fixes=%fixes% %mas%
echo %mas%
) else (
echo Required license files were not found in %SysPath%\spp\tokens\skus\
if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
if defined skunotfound (
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
)
if defined sppks (
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
set fixes=%fixes% %mas%troubleshoot
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% "Use TSforge activation option from the main menu."
set fixes=%fixes% %mas%
echo %mas%
)
echo:
goto dk_done
)
@ -651,7 +683,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
:: Stop sppsvc
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
sc query sppsvc | find /i "STOPPED" %nul% && (
echo Stopping sppsvc Service [Successful]
@ -660,7 +692,7 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
)
%_xmlexist% (
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
%_xmlexist% timeout /t 2 %nul%
%_xmlexist% timeout /t 2 %nul%
@ -860,12 +892,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -875,6 +910,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
@ -1067,7 +1103,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
exit /b
:: Install License files using Powershell/WMI instead of slmgr.vbs
@ -1118,7 +1154,7 @@ echo sc start sppsvc [Error Code: %spperror%]
)
echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -1217,26 +1253,16 @@ exit /b
set w=
set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
set pupfound=%pupfound1%%pupfound2%
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
if not defined pupfound (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
)
set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0
for %%# in (wuauserv) do (
set _corrupt=
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
)
)
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]"
@ -1252,6 +1278,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
)
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
if exist %SysPath%\Tasks\R@1n-KMS (
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
)
exit /b
::========================================================================================================================================
@ -1343,7 +1376,7 @@ set errorcode=
set checkerror=
sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
)
@ -1360,6 +1393,11 @@ echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
set showfix=1
)
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
set showfix=1
)
)
::========================================================================================================================================
@ -1373,7 +1411,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
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" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
@ -1381,6 +1422,10 @@ 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% && (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
)
@ -1403,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"
@ -1414,7 +1458,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -1423,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%]"
)
)
@ -1457,7 +1503,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed (
set error=1
call :dk_color %Red% "Checking WMI [Not Working]"
@ -1466,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"
@ -1499,21 +1545,16 @@ 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" (
sc query wlms | find /i "RUNNING" %nul% && (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
@ -1534,15 +1575,14 @@ echo Checking SPP In IFEO [%_sppint%]
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
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 10 | Out-Null"
set error=1
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1
set showfix=1
)
@ -1581,20 +1621,22 @@ 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 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
%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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found"
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
set error=1
set "_notfoundids=Not found"
)
set error=1
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -1604,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."
)
)
)
@ -1617,7 +1662,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror=
if %winbuild% GEQ 9200 (
if %winbuild% GEQ 9200 if not defined ps32onArm (
for %%# in (
"%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -1751,6 +1796,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))

View File

@ -1,4 +1,4 @@
@set masver=2.7
@set masver=3.0
@echo off
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -107,7 +109,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -143,6 +145,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="/Ohook" set _act=1
@ -157,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%].
@ -200,15 +214,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -256,6 +271,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -281,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 (
@ -299,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
@ -394,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
@ -410,11 +431,14 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v P
%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
%nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
if %winbuild% GEQ 10240 (
for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty InstallLocation)" %nul6%') do (if exist "%%a\Integration\Integrator.exe" set o16uwp=Office UWP )
)
if not "%o14msi%%o14c2r%%o16uwp%"=="" (
echo:
call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%%o16uwp%]"
if not "%o14msi%%o16uwp%"=="" call :dk_color %Blue% "Use Online KMS option to activate it."
)
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
@ -486,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
@ -520,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"
)
@ -570,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"
)
@ -704,7 +718,12 @@ reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
reg query HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && reg delete HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
reg unload HKU\DEF_TEMP %nul%
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty $('{0}\{1}' -f $p, $_.PSChildName)).ProfileImagePath; if ($pi -like $('{0}\Users\*' -f $Env:SystemDrive)) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
set _sidlist=
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
if not defined _sidlist (
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
)
for %%# in (!_sidlist!) do (
@ -839,14 +858,15 @@ exit /b
if not defined _oLPath exit /b
if defined _oIntegrator (
if %oVer%==16 (
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
) else (
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
)
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
)
:: Fallback to manual method to install licenses incase integrator.exe is not working
@ -958,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=
@ -987,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
@ -1020,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"
)
@ -1060,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
@ -1160,7 +1134,6 @@ rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
for %%x in (15 16) do (
for %%# in (%_sidlist%) do (
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul%
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Identity /f %nul%
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
rmdir /s /q "%%b\AppData\Local\Microsoft\Office\Licenses\" %nul%
@ -1173,6 +1146,22 @@ reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f %
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f /reg:32 %nul%
)
:: Clear vNext in UWP Office
if defined o16uwpapplist (
for %%# in (%_sidlist%) do (
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\LocalCache\Local\Microsoft\Office\Licenses\" %nul%
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
set defname=DEFTEMP-%%#
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
reg unload HKU\!defname! %nul%
)
)
)
)
:: Clear SharedComputerLicensing for office
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
@ -1210,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% && (
@ -1246,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 (
@ -1268,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
@ -1328,12 +1314,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -1343,6 +1332,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
@ -1419,6 +1409,22 @@ set allapps=
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
set len=0
echo:!allapps!> %SystemRoot%\Temp\chklen
for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA)
del %SystemRoot%\Temp\chklen %nul%
if !len! GTR 6000 (
%eline%
echo Too many licenses are installed, the script may crash.
call :dk_color %Blue% "%_fixmsg%"
timeout /t 30
)
)
exit /b
:: Get installed products Activation IDs
@ -1479,7 +1485,7 @@ echo sc start sppsvc [Error Code: %spperror%]
)
echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -1517,26 +1523,16 @@ exit /b
set w=
set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
set pupfound=%pupfound1%%pupfound2%
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
if not defined pupfound (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
)
set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0
for %%# in (wuauserv) do (
set _corrupt=
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
)
)
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]"
@ -1552,6 +1548,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
)
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
if exist %SysPath%\Tasks\R@1n-KMS (
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
)
exit /b
::========================================================================================================================================
@ -1643,7 +1646,7 @@ set errorcode=
set checkerror=
sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
)
@ -1660,6 +1663,11 @@ echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
set showfix=1
)
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
set showfix=1
)
)
::========================================================================================================================================
@ -1673,7 +1681,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
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" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
@ -1681,6 +1692,10 @@ 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% && (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
)
@ -1703,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"
@ -1714,7 +1728,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -1723,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%]"
)
)
@ -1757,7 +1773,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed (
set error=1
call :dk_color %Red% "Checking WMI [Not Working]"
@ -1766,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"
@ -1799,21 +1815,16 @@ 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" (
sc query wlms | find /i "RUNNING" %nul% && (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
@ -1834,15 +1845,14 @@ echo Checking SPP In IFEO [%_sppint%]
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
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 10 | Out-Null"
set error=1
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1
set showfix=1
)
@ -1881,20 +1891,22 @@ 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 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
%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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found"
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
set error=1
set "_notfoundids=Not found"
)
set error=1
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -1904,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."
)
)
)
@ -1917,7 +1932,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror=
if %winbuild% GEQ 9200 (
if %winbuild% GEQ 9200 if not defined ps32onArm (
for %%# in (
"%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -2051,6 +2066,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
@ -2081,6 +2097,7 @@ set f=
for %%# in (
:: Office 2013
15_ab4d047b-97cf-4126-a69f-34df08e2f254_B7RFY-7NXPK-Q4342-Y9X2H-3J%f%X4X_Retail________AccessRetail
15_259de5be-492b-44b3-9d78-9645f848f7b0_X3XNB-HJB7K-66THH-8DWQ3-XH%f%GJP_Bypass________AccessRuntimeRetail
15_4374022d-56b8-48c1-9bb7-d8f2fc726343_9MF9G-CN32B-HV7XT-9XJ8T-9K%f%VF4_MAK___________AccessVolume
15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_NT889-MBH4X-8MD4H-X8R2D-WQ%f%HF8_Retail________ExcelRetail
15_ac1ae7fd-b949-4e04-a330-849bc40638cf_Y3N36-YCHDK-XYWBG-KYQVV-BD%f%TJ2_MAK___________ExcelVolume
@ -2088,6 +2105,8 @@ for %%# in (
15_4825ac28-ce41-45a7-9e6e-1fed74057601_RN84D-7HCWY-FTCBK-JMXWM-HT%f%7GJ_MAK___________GrooveVolume
15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_2WQNF-GBK4B-XVG6F-BBMX7-M4%f%F2Y_OEM-Perp______HomeBusinessPipcRetail
15_a2b90e7a-a797-4713-af90-f0becf52a1dd_YWD4R-CNKVT-VG8VJ-9333B-RC%f%W9F_Subscription__HomeBusinessRetail
15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_B92QY-NKYFQ-6KTKH-VWW2Q-3P%f%B3B_OEM-ARM_______HomeStudentARMRetail
15_ebef9f05-5273-404a-9253-c5e252f50555_QPG96-CNT7M-KH36K-KY4HQ-M7%f%TBR_OEM-ARM_______HomeStudentPlusARMRetail
15_f2de350d-3028-410a-bfae-283e00b44d0e_6WW3N-BDGM9-PCCHD-9QPP9-P3%f%4QG_Subscription__HomeStudentRetail
15_44984381-406e-4a35-b1c3-e54f499556e2_RV7NQ-HY3WW-7CKWH-QTVMW-29%f%VHC_Retail________InfoPathRetail
15_9e016989-4007-42a6-8051-64eb97110cf2_C4TGN-QQW6Y-FYKXC-6WJW7-X7%f%3VG_MAK___________InfoPathVolume
@ -2126,16 +2145,16 @@ for %%# in (
15_191509f2-6977-456f-ab30-cf0492b1e93a_NB77V-RPFQ6-PMMKQ-T87DV-M4%f%D84_Retail________WordRetail
15_9cedef15-be37-4ff0-a08a-13a045540641_RPHPB-Y7NC4-3VYFM-DW7VD-G8%f%YJ8_MAK___________WordVolume
:: Office 365 - 15.0 version
15_6337137e-7c07-4197-8986-bece6a76fc33_2P3C9-BQNJH-VCVPH-YDY6M-43%f%JPQ_Subscription__O365BusinessRetail
15_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail
15_149dbce7-a48e-44db-8364-a53386cd4580_2N382-D6PKK-QTX4D-2JJYK-M9%f%6P2_Subscription1_O365ProPlusRetail
15_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail
15_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail
15_a96f8dae-da54-4fad-bdc6-108da592707a_3NMDC-G7C3W-68RGP-CB4MH-4C%f%XCH_SubTest1______O365HomePremRetail
15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail
15_0bc1dae4-6158-4a1c-a893-807665b934b2_2QCNB-RMDKJ-GC8PB-7QGQV-7Q%f%TQJ_Subscription2_O365SmallBusPremRetail
:: Office 365 - 16.0 version
16_6337137e-7c07-4197-8986-bece6a76fc33_2P3C9-BQNJH-VCVPH-YDY6M-43%f%JPQ_Subscription__O365BusinessRetail
16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail
16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W62NQ-267QR-RTF74-PF2MH-JQ%f%MTH_Subscription__O365EduCloudRetail
16_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail
16_149dbce7-a48e-44db-8364-a53386cd4580_2N382-D6PKK-QTX4D-2JJYK-M9%f%6P2_Subscription1_O365ProPlusRetail
16_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail
16_a96f8dae-da54-4fad-bdc6-108da592707a_3NMDC-G7C3W-68RGP-CB4MH-4C%f%XCH_SubTest1______O365HomePremRetail
16_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail
16_0bc1dae4-6158-4a1c-a893-807665b934b2_2QCNB-RMDKJ-GC8PB-7QGQV-7Q%f%TQJ_Subscription2_O365SmallBusPremRetail
:: Office 2016
16_bfa358b0-98f1-4125-842e-585fa13032e6_WHK4N-YQGHB-XWXCC-G3HYC-6J%f%F94_Retail________AccessRetail
16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_RNB7V-P48F4-3FYY6-2P3R3-63%f%BQV_PrepidBypass__AccessRuntimeRetail
@ -2144,6 +2163,8 @@ for %%# in (
16_685062a7-6024-42e7-8c5f-6bb9e63e697f_FVGNR-X82B2-6PRJM-YT4W7-8H%f%V36_MAK___________ExcelVolume
16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_2WQNF-GBK4B-XVG6F-BBMX7-M4%f%F2Y_OEM-Perp______HomeBusinessPipcRetail
16_86834d00-7896-4a38-8fae-32f20b86fa2b_HM6FM-NVF78-KV9PM-F36B8-D9%f%MXD_Retail________HomeBusinessRetail
16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_PBQPJ-NC22K-69MXD-KWMRF-WF%f%G77_OEM-ARM_______HomeStudentARMRetail
16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_6F2NY-7RTX4-MD9KM-TJ43H-94%f%TBT_OEM-ARM_______HomeStudentPlusARMRetail
16_c28acdb8-d8b3-4199-baa4-024d09e97c99_PNPRV-F2627-Q8JVC-3DGR9-WT%f%YRK_Retail________HomeStudentRetail
16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_YWD4R-CNKVT-VG8VJ-9333B-RC%f%3B8_Retail________HomeStudentVNextRetail
16_69ec9152-153b-471a-bf35-77ec88683eae_VNWHF-FKFBW-Q2RGD-HYHWF-R3%f%HH2_Subscription__MondoRetail
@ -2190,6 +2211,8 @@ for %%# in (
16_c201c2b7-02a1-41a8-b496-37c72910cd4a_KBPNW-64CMM-8KWCB-23F44-8B%f%7HM_Retail________Excel2019Retail
16_05cb4e1d-cc81-45d5-a769-f34b09b9b391_8NT4X-GQMCK-62X4P-TW6QP-YK%f%PYF_MAK-AE________Excel2019Volume
16_7fe09eef-5eed-4733-9a60-d7019df11cac_QBN2Y-9B284-9KW78-K48PB-R6%f%2YT_Retail________HomeBusiness2019Retail
16_6303d14a-afad-431f-8434-81052a65f575_DJTNY-4HDWM-TDWB2-8PWC2-W2%f%RRT_OEM-ARM_______HomeStudentARM2019Retail
16_215c841d-ffc1-4f03-bd11-5b27b6ab64cc_NM8WT-CFHB2-QBGXK-J8W6J-GV%f%K8F_OEM-ARM_______HomeStudentPlusARM2019Retail
16_4539aa2c-5c31-4d47-9139-543a868e5741_XNWPM-32XQC-Y7QJC-QGGBV-YY%f%7JK_Retail________HomeStudent2019Retail
16_20e359d5-927f-47c0-8a27-38adbdd27124_WR43D-NMWQQ-HCQR2-VKXDR-37%f%B7H_Retail________Outlook2019Retail
16_92a99ed8-2923-4cb7-a4c5-31da6b0b8cf3_RN3QB-GT6D7-YB3VH-F3RPB-3G%f%QYB_MAK-AE________Outlook2019Volume
@ -2219,11 +2242,14 @@ for %%# in (
:: Office 2021
16_f634398e-af69-48c9-b256-477bea3078b5_P286B-N3XYP-36QRQ-29CMP-RV%f%X9M_Retail________Access2021Retail
16_ae17db74-16b0-430b-912f-4fe456e271db_JBH3N-P97FP-FRTJD-MGK2C-VF%f%WG6_MAK-AE________Access2021Volume
16_844c36cb-851c-49e7-9079-12e62a049e2a_MNX9D-PB834-VCGY2-K2RW2-2D%f%P3D_Bypass________AccessRuntime2021Retail
16_fb099c19-d48b-4a2f-a160-4383011060aa_V6QFB-7N7G9-PF7W9-M8FQM-MY%f%8G9_Retail________Excel2021Retail
16_9da1ecdb-3a62-4273-a234-bf6d43dc0778_WNYR4-KMR9H-KVC8W-7HJ8B-K7%f%9DQ_MAK-AE________Excel2021Volume
16_38b92b63-1dff-4be7-8483-2a839441a2bc_JM99N-4MMD8-DQCGJ-VMYFY-R6%f%3YK_Subscription__HomeBusiness2021Retail
16_2f258377-738f-48dd-9397-287e43079958_N3CWD-38XVH-KRX2Y-YRP74-6R%f%BB2_Subscription__HomeStudent2021Retail
16_279706f4-3a4b-4877-949b-f8c299cf0cc5_NB2TQ-3Y79C-77C6M-QMY7H-7Q%f%Y8P_Retail________OneNote2021Retail
16_0c7af60d-0664-49fc-9b01-41b2dea81380_THNKC-KFR6C-Y86Q9-W8CB3-GF%f%7PD_MAK-AE________OneNote2021Volume
16_778ccb9a-2f6a-44e5-853c-eb22b7609643_CNM3W-V94GB-QJQHH-BDQ3J-33%f%Y8H_Bypass________OneNoteFree2021Retail
16_ecea2cfa-d406-4a7f-be0d-c6163250d126_4NCWR-9V92Y-34VB2-RPTHR-YT%f%GR7_Retail________Outlook2021Retail
16_45bf67f9-0fc8-4335-8b09-9226cef8a576_JQ9MJ-QYN6B-67PX9-GYFVY-QJ%f%6TB_MAK-AE________Outlook2021Volume
16_8f89391e-eedb-429d-af90-9d36fbf94de6_RRRYB-DN749-GCPW4-9H6VK-HC%f%HPT_Retail________Personal2021Retail
@ -2302,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.7
@set masver=3.0
@echo off
@ -69,26 +69,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -132,7 +134,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -169,6 +171,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args for %%A in (%_args%) do (
if /i "%%A"=="-el" (set _elev=1)
if /i "%%A"=="/K-Windows" (set _actwin=1)
@ -188,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%].
@ -229,15 +243,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -285,6 +300,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -310,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 (
@ -328,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)
)
)
@ -477,6 +497,7 @@ set "_serv=sppsvc Winmgmt"
:: Software Protection
:: Windows Management Instrumentation
if %_actwin%==0 set notwinact=1
call :dk_errorcheck
::========================================================================================================================================
@ -513,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"
)
@ -556,15 +578,27 @@ call :dk_color %Red% "Checking Alternate Edition For %KS% [%altedition% Act
if not defined key if not defined _gvlk (
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound (
echo This product does not support %KS% activation.
set fixes=%fixes% %mas%unsupported_products_activation
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation"
) else (
echo Required license files not found in %SysPath%\spp\tokens\skus\
if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VLKMS*.xrm-ms" set sppks=1
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1
if defined skunotfound (
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
)
if defined sppks (
call :dk_color %Red% "%KS% activation is supported but failed to find the %KS% key."
set fixes=%fixes% %mas%troubleshoot
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."
call :dk_color %Blue% "Use TSforge activation option from the main menu."
)
echo:
goto :ks_office
)
@ -627,18 +661,14 @@ call :dk_color %Gray% "Checking Ohook [Ohook activation
:: Check unsupported office versions
set o14c2r=
set o16uwp=
set _68=HKLM\SOFTWARE\Microsoft\Office
set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
%nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
if not "%o14c2r%%o16uwp%"=="" (
if not "%o14c2r%"=="" (
echo:
call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%%o16uwp%]"
call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%]"
)
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
@ -651,6 +681,13 @@ set ohub=1
call :ks_getpath
set o16uwp=
set o16uwp_path=
if %winbuild% GEQ 10240 (
for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty InstallLocation)" %nul6%') do (if exist "%%a\Integration\Integrator.exe" (set o16uwp=1&set "o16uwp_path=%%a"))
)
sc query ClickToRunSvc %nul%
set error1=%errorlevel%
@ -671,10 +708,10 @@ set o15c2r=
set error=1
)
if "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" (
if "%o16uwp%%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" (
set error=1
echo:
if not "%o14c2r%%o16uwp%"=="" (
if not "%o14c2r%"=="" (
call :dk_color %Red% "Checking Supported Office Install [Not Found]"
) else (
call :dk_color %Red% "Checking Installed Office [Not Found]"
@ -691,8 +728,8 @@ goto :ks_activate
)
set multioffice=
if not "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1
if not "%o14c2r%%o16uwp%"=="" set multioffice=1
if not "%o16uwp%%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1
if not "%o14c2r%"=="" set multioffice=1
if defined multioffice (
echo:
@ -701,6 +738,46 @@ call :dk_color %Gray% "Checking Multiple Office Install [Found. Recommend
::========================================================================================================================================
:: Process Office UWP
if not defined o16uwp goto :ks_starto15c2r
call :ks_reset
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
set oVer=16
set "_oLPath=%o16uwp_path%\Licenses16"
for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty Dependencies) | Select-Object PackageFullName" %nul6%') do (set "o16uwpapplist=!o16uwpapplist! %%a")
echo "%o16uwpapplist%" | findstr /i "Access Excel OneNote Outlook PowerPoint Publisher SkypeForBusiness Word" %nul% && set "_oIds=O365HomePremRetail"
for %%# in (Project Visio) do (
echo "%o16uwpapplist%" | findstr /i "%%#" %nul% && (
set _lat=
if exist "%_oLPath%\%%#Pro2024VL*.xrm-ms" set "_oIds= !_oIds! %%#Pro2024Retail " & set _lat=1
if not defined _lat if exist "%_oLPath%\%%#Pro2021VL*.xrm-ms" set "_oIds= !_oIds! %%#Pro2021Retail " & set _lat=1
if not defined _lat if exist "%_oLPath%\%%#Pro2019VL*.xrm-ms" set "_oIds= !_oIds! %%#Pro2019Retail " & set _lat=1
if not defined _lat set "_oIds= !_oIds! %%#ProRetail "
)
)
set uwpinfo=%o16uwp_path:C:\Program Files\WindowsApps\Microsoft.Office.Desktop_=%
echo:
echo Processing Office... [UWP ^| %uwpinfo%]
if not defined _oIds (
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]"
set error=1
goto :ks_starto15c2r
)
call :ks_process
::========================================================================================================================================
:ks_starto15c2r
:: Process Office 15.0 C2R
if not defined o15c2r goto :ks_starto16c2r
@ -791,7 +868,7 @@ if defined o16msi call :ks_processmsi 16 %o16msi_reg%
echo:
call :oh_clearblock
if "%o16msi%%o15msi%"=="" if not "%o16c2r%%o15c2r%"=="" if "%keyerror%"=="0" if %_NoEditionChange%==0 call :oh_uninstkey
if "%o16msi%%o15msi%"=="" if not "%o16uwp%%o16c2r%%o15c2r%"=="" if "%keyerror%"=="0" if %_NoEditionChange%==0 call :oh_uninstkey
call :oh_licrefresh
::========================================================================================================================================
@ -990,6 +1067,8 @@ exit /b
:ks_osppready
if not defined _config exit /b
echo: %_config% | find /i "propertyBag" %nul1% && (
set "_osppt=REG_DWORD"
set "_osppready=%o15c2r_reg%"
@ -1156,14 +1235,15 @@ exit /b
if not defined _oLPath exit /b
if defined _oIntegrator (
if %oVer%==16 (
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
) else (
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
)
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
)
:: Fallback to manual method to install licenses incase integrator.exe is not working
@ -1261,7 +1341,6 @@ rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
for %%x in (15 16) do (
for %%# in (%_sidlist%) do (
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul%
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Identity /f %nul%
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
rmdir /s /q "%%b\AppData\Local\Microsoft\Office\Licenses\" %nul%
@ -1274,6 +1353,22 @@ reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f %
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f /reg:32 %nul%
)
:: Clear vNext in UWP Office
if defined o16uwpapplist (
for %%# in (%_sidlist%) do (
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\LocalCache\Local\Microsoft\Office\Licenses\" %nul%
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
set defname=DEFTEMP-%%#
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
reg unload HKU\!defname! %nul%
)
)
)
)
:: Clear SharedComputerLicensing for office
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
@ -1311,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% && (
@ -1347,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 (
@ -1369,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
@ -1748,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
@ -2228,12 +2319,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -2243,6 +2337,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
@ -2391,6 +2486,22 @@ set allapps=
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
set len=0
echo:!allapps!> %SystemRoot%\Temp\chklen
for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA)
del %SystemRoot%\Temp\chklen %nul%
if !len! GTR 6000 (
%eline%
echo Too many licenses are installed, the script may crash.
call :dk_color %Blue% "%_fixmsg%"
timeout /t 30
)
)
exit /b
:: Get installed products Activation IDs
@ -2416,7 +2527,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
exit /b
:: Install License files using Powershell/WMI instead of slmgr.vbs
@ -2467,7 +2578,7 @@ echo sc start sppsvc [Error Code: %spperror%]
)
echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -2566,26 +2677,16 @@ exit /b
set w=
set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
set pupfound=%pupfound1%%pupfound2%
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
if not defined pupfound (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
)
set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0
for %%# in (wuauserv) do (
set _corrupt=
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
)
)
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]"
@ -2601,6 +2702,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
)
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
if exist %SysPath%\Tasks\R@1n-KMS (
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
)
exit /b
::========================================================================================================================================
@ -2692,7 +2800,7 @@ set errorcode=
set checkerror=
sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
)
@ -2709,6 +2817,11 @@ echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
set showfix=1
)
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
set showfix=1
)
)
::========================================================================================================================================
@ -2722,7 +2835,10 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
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" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
@ -2730,6 +2846,10 @@ 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% && (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
)
@ -2752,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"
@ -2763,7 +2882,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -2772,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%]"
)
)
@ -2806,7 +2927,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed (
set error=1
call :dk_color %Red% "Checking WMI [Not Working]"
@ -2815,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"
@ -2848,21 +2969,16 @@ 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" (
sc query wlms | find /i "RUNNING" %nul% && (
if %winbuild% LSS 9200 (
echo Checking Eval WLMS Service [Found]
) else (
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
)
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
@ -2883,15 +2999,14 @@ echo Checking SPP In IFEO [%_sppint%]
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
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 10 | Out-Null"
set error=1
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1
set showfix=1
)
@ -2930,20 +3045,22 @@ 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 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
%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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found"
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
set error=1
set "_notfoundids=Not found"
)
set error=1
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
@ -2953,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."
)
)
)
@ -2966,7 +3086,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror=
if %winbuild% GEQ 9200 (
if %winbuild% GEQ 9200 if not defined ps32onArm (
for %%# in (
"%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -3100,6 +3220,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
@ -3160,10 +3281,13 @@ for %%# in (
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_WordR
:: Office 2013
15_ab4d047b-97cf-4126-a69f-34df08e2f254_AccessRetail
15_259de5be-492b-44b3-9d78-9645f848f7b0_AccessRuntimeRetail
15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_ExcelRetail
15_cfaf5356-49e3-48a8-ab3c-e729ab791250_GrooveRetail
15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail
15_a2b90e7a-a797-4713-af90-f0becf52a1dd_HomeBusinessRetail
15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_HomeStudentARMRetail
15_ebef9f05-5273-404a-9253-c5e252f50555_HomeStudentPlusARMRetail
15_f2de350d-3028-410a-bfae-283e00b44d0e_HomeStudentRetail
15_44984381-406e-4a35-b1c3-e54f499556e2_InfoPathRetail
15_9103f3ce-1084-447a-827e-d6097f68c895_LyncAcademicRetail
@ -3205,6 +3329,8 @@ for %%# in (
16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail
16_86834d00-7896-4a38-8fae-32f20b86fa2b_HomeBusinessRetail
16_c28acdb8-d8b3-4199-baa4-024d09e97c99_HomeStudentRetail
16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_HomeStudentARMRetail
16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_HomeStudentPlusARMRetail
16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_HomeStudentVNextRetail
16_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail
16_436366de-5579-4f24-96db-3893e4400030_OneNoteFreeRetail
@ -3368,7 +3494,6 @@ ae2ee509-1b34-41c0-acb7-6d4650168915_33PXH-7Y6KF-2VJC9-XBBR8-HV%f%THH___4_Enterp
b92e9980-b9d5-4821-9c94-140f632f6312_FJ82H-XT6CR-J8D7P-XQJJ2-GP%f%DD4__48_Professional
54a09a0d-d57b-4c10-8b69-a842d6590ad5_MRPKT-YTG23-K7D7T-X2JMM-QY%f%7MG__49_ProfessionalN
db537896-376f-48ae-a492-53d0547773d0_YBYF6-BHCR3-JPKRB-CDW7B-F9%f%BK4__65_Embedded_POSReady
e1a8296a-db37-44d1-8cce-7bc961d59c54_XGY72-BRBBT-FF8MH-2GG8H-W7%f%KCW__65_Embedded_Standard
aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395_73KQT-CD9G6-K7TQG-66MRP-CQ%f%22C__65_Embedded_ThinPC
5a041529-fef8-4d07-b06f-b59b573b32d2_W82YF-2Q76Y-63HXB-FGJG9-GF%f%7QX__69_ProfessionalE
46bbed08-9c7b-48fc-a614-95250573f4ea_C29WB-22CC8-VJ326-GHFJW-H9%f%DH4__70_EnterpriseE
@ -3404,6 +3529,7 @@ ea509e87-07a1-4a45-9edc-eba5a39f36af_D6QFG-VBYP2-XQHM7-J97RH-VV%f%RCK__14_SmallB
2d0882e7-a4e7-423b-8ccc-70d91e0158b1_HVHB3-C6FV7-KQX9W-YQG79-CR%f%Y7T__14_WordVL
:: Office 2013
6ee7622c-18d8-4005-9fb7-92db644a279b_NG2JY-H4JBT-HQXYP-78QH9-4J%f%M2D__15_AccessVolume_-AccessRetail-
259de5be-492b-44b3-9d78-9645f848f7b0_X3XNB-HJB7K-66THH-8DWQ3-XH%f%GJP__15_AccessRuntimeRetail_[Bypass]
f7461d52-7c2b-43b2-8744-ea958e0bd09a_VGPNG-Y7HQW-9RHP7-TKPV3-BG%f%7GB__15_ExcelVolume_-ExcelRetail-
fb4875ec-0c6b-450f-b82b-ab57d8d1677f_H7R7V-WPNXQ-WCYYC-76BGV-VT%f%7GH__15_GrooveVolume_-GrooveRetail-
a30b8040-d68a-423f-b0b5-9ce292ea5a8f_DKT8B-N7VXH-D963P-Q4PHY-F8%f%894__15_InfoPathVolume_-InfoPathRetail-
@ -3421,7 +3547,7 @@ efe1f3e6-aea2-4144-a208-32aa872b6545_TGN6P-8MMBC-37P2F-XHXXK-P3%f%4VW__15_OneNot
b322da9c-a2e2-4058-9e4e-f59a6970bd69_YC7DK-G2NP3-2QQC3-J6H88-GV%f%GXT__15_ProPlusVolume_-ProPlusRetail-ProfessionalPipcRetail-ProfessionalRetail-
00c79ff1-6850-443d-bf61-71cde0de305f_PN2WF-29XG2-T9HJ7-JQPJR-FC%f%XK4__15_PublisherVolume_-PublisherRetail-
ba3e3833-6a7e-445a-89d0-7802a9a68588_3NY6J-WHT3F-47BDV-JHF36-23%f%43W__15_SPDRetail_[PrepidBypass]
b13afb38-cd79-4ae5-9f7f-eed058d750ca_KBKQT-2NMXY-JJWGP-M62JB-92%f%CD4__15_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentRetail-PersonalPipcRetail-PersonalRetail-
b13afb38-cd79-4ae5-9f7f-eed058d750ca_KBKQT-2NMXY-JJWGP-M62JB-92%f%CD4__15_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentARMRetail-HomeStudentPlusARMRetail-HomeStudentRetail-PersonalPipcRetail-PersonalRetail-
e13ac10e-75d0-4aff-a0cd-764982cf541c_C2FG9-N6J68-H8BTJ-BW3QX-RM%f%3B3__15_VisioProVolume_-VisioProRetail-
ac4efaf0-f81f-4f61-bdf7-ea32b02ab117_J484Y-4NKBF-W2HMG-DBMJC-PG%f%WR7__15_VisioStdVolume_-VisioStdRetail-
d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3_6Q7VD-NX8JD-WJ2VH-88V73-4G%f%BJ7__15_WordVolume_-WordRetail-
@ -3444,7 +3570,7 @@ d450596f-894d-49e0-966a-fd39ed4c4c64_XQNVK-8JYDB-WJ9W3-YJ8YR-WF%f%G99__16_ProPlu
9103f3ce-1084-447a-827e-d6097f68c895_6MDN4-WF3FV-4WH3Q-W699V-RG%f%CMY__16_SkypeServiceBypassRetail_[PrepidBypass]
971cd368-f2e1-49c1-aedd-330909ce18b6_4N4D8-3J7Y3-YYW7C-73HD2-V8%f%RHY__16_SkypeforBusinessEntryRetail_[PrepidBypass]
83e04ee1-fa8d-436d-8994-d31a862cab77_869NQ-FJ69K-466HW-QYCP2-DD%f%BV6__16_SkypeforBusinessVolume_-SkypeforBusinessRetail-
dedfa23d-6ed1-45a6-85dc-63cae0546de6_JNRGM-WHDWX-FJJG3-K47QV-DR%f%TFM__16_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentRetail-HomeStudentVNextRetail-PersonalPipcRetail-PersonalRetail-
dedfa23d-6ed1-45a6-85dc-63cae0546de6_JNRGM-WHDWX-FJJG3-K47QV-DR%f%TFM__16_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentARMRetail-HomeStudentPlusARMRetail-HomeStudentRetail-HomeStudentVNextRetail-PersonalPipcRetail-PersonalRetail-
6bf301c1-b94a-43e9-ba31-d494598c47fb_PD3PC-RHNGV-FXJ29-8JK7D-RJ%f%RJK__16_VisioProVolume_-VisioProRetail-
b234abe3-0857-4f9c-b05a-4dc314f85557_69WXN-MBYV6-22PQG-3WGHK-RM%f%6XC__16_VisioProXVolume
aa2a7821-1827-4c2c-8f1d-4513a34dda97_7WHWN-4T7MP-G96JF-G33KR-W8%f%GF4__16_VisioStdVolume_-VisioStdRetail-
@ -3462,14 +3588,17 @@ c8f8a301-19f5-4132-96ce-2de9d4adbd33_7HD7K-N4PVK-BHBCQ-YWQRW-XW%f%4VK__16_Outloo
9d3e4cca-e172-46f1-a2f4-1d2107051444_G2KWX-3NW6P-PY93R-JXK2T-C9%f%Y9V__16_Publisher2019Volume_-Publisher2019Retail-
734c6c6e-b0ba-4298-a891-671772b2bd1b_NCJ33-JHBBY-HTK98-MYCV8-HM%f%KHJ__16_SkypeforBusiness2019Volume_-SkypeforBusiness2019Retail-
f88cfdec-94ce-4463-a969-037be92bc0e7_N9722-BV9H6-WTJTT-FPB93-97%f%8MK__16_SkypeforBusinessEntry2019Retail_[PrepidBypass]
6912a74b-a5fb-401a-bfdb-2e3ab46f4b02_6NWWJ-YQWMR-QKGCB-6TMB3-9D%f%9HK__16_Standard2019Volume_-Standard2019Retail-HomeBusiness2019Retail-HomeStudent2019Retail-Personal2019Retail-
6912a74b-a5fb-401a-bfdb-2e3ab46f4b02_6NWWJ-YQWMR-QKGCB-6TMB3-9D%f%9HK__16_Standard2019Volume_-Standard2019Retail-HomeBusiness2019Retail-HomeStudentARM2019Retail-HomeStudentPlusARM2019Retail-HomeStudent2019Retail-Personal2019Retail-
5b5cf08f-b81a-431d-b080-3450d8620565_9BGNQ-K37YR-RQHF2-38RQ3-7V%f%CBB__16_VisioPro2019Volume_-VisioPro2019Retail-
e06d7df3-aad0-419d-8dfb-0ac37e2bdf39_7TQNQ-K3YQQ-3PFH7-CCPPM-X4%f%VQ2__16_VisioStd2019Volume_-VisioStd2019Retail-
059834fe-a8ea-4bff-b67b-4d006b5447d3_PBX3G-NWMT6-Q7XBW-PYJGG-WX%f%D33__16_Word2019Volume_-Word2019Retail-
:: Office 2021
:: OneNote2021Volume KMS license is not available
844c36cb-851c-49e7-9079-12e62a049e2a_MNX9D-PB834-VCGY2-K2RW2-2D%f%P3D__16_AccessRuntime2021Retail_[Bypass]
1fe429d8-3fa7-4a39-b6f0-03dded42fe14_WM8YG-YNGDD-4JHDC-PG3F4-FC%f%4T4__16_Access2021Volume_-Access2021Retail-
ea71effc-69f1-4925-9991-2f5e319bbc24_NWG3X-87C9K-TC7YY-BC2G7-G6%f%RVC__16_Excel2021Volume_-Excel2021Retail-
a5799e4c-f83c-4c6e-9516-dfe9b696150b_C9FM6-3N72F-HFJXB-TM3V9-T8%f%6R9__16_Outlook2021Volume_-Outlook2021Retail-
778ccb9a-2f6a-44e5-853c-eb22b7609643_CNM3W-V94GB-QJQHH-BDQ3J-33%f%Y8H__16_OneNoteFree2021Retail_[Bypass]
6e166cc3-495d-438a-89e7-d7c9e6fd4dea_TY7XF-NFRBR-KJ44C-G83KF-GX%f%27K__16_PowerPoint2021Volume_-PowerPoint2021Retail-
76881159-155c-43e0-9db7-2d70a9a3a4ca_FTNWT-C6WBT-8HMGF-K9PRX-QV%f%9H8__16_ProjectPro2021Volume_-ProjectPro2021Retail-
6dd72704-f752-4b71-94c7-11cec6bfc355_J2JDC-NJCYY-9RGQ4-YXWMH-T3%f%D4T__16_ProjectStd2021Volume_-ProjectStd2021Retail-

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.7
@set masver=3.0
@echo off
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -67,7 +69,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -103,6 +105,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1
@ -119,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%].
@ -160,15 +174,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -216,6 +231,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -241,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 (
@ -259,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)
)
)
@ -516,13 +536,23 @@ goto :oe_goback
set inpt=
set counter=0
set verified=0
set _notfound=
set targetedition=
%line%
echo:
call :dk_color %Gray% "Installed Office editions: %_oIds%"
call :dk_color %Gray% "You can select one of the following Office Editions."
if %winbuild% LSS 10240 echo Unsupported products such as 2019/2021/2024 are excluded from this list.
if %winbuild% LSS 10240 (
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
) else (
for %%# in (2019 2021 2024) do (
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || (
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
)
)
if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this list because old version [%_version%] of Office is installed."
)
%line%
echo:
@ -1048,6 +1078,7 @@ call :oe_tempcleanup
echo:
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
@ -1299,12 +1330,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -1314,6 +1348,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
@ -1356,7 +1391,7 @@ echo sc start sppsvc [Error Code: %spperror%]
)
echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
exit /b
:: Common lines used in PowerShell reflection code
@ -1396,6 +1431,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))

View File

@ -1,4 +1,4 @@
@set masver=2.7
@set masver=3.0
@echo off
@ -36,26 +36,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -72,7 +74,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -108,6 +110,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1
@ -124,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%].
@ -165,15 +179,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -221,6 +236,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -246,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 (
@ -264,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)
)
)
@ -330,12 +350,12 @@ if defined UBR (set "fullbuild=%%G.!UBR!") else (set "fullbuild=%%G.%%H")
::========================================================================================================================================
:: Check Activation ID
:: Check Activation IDs
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
%eline%
echo Either key is not insalled or script failed to get installed key's activation ID. Aborting...
echo Failed to find activation IDs. Aborting...
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -346,15 +366,17 @@ goto dk_done
:: Check Windows Edition and branch
set osedition=0
set dismedition=
set osedition=
set dismnotworking=
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "osedition=%%a"
if not defined osedition set dismnotworking=1
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if not defined osedition %chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 (
if not defined osedition (
%eline%
echo Failed to detect OS edition, aborting...
echo:
@ -365,12 +387,9 @@ goto dk_done
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "regedition=%%a"
if /i not "%osedition%"=="%regedition%" (
set "showeditionerror=call :dk_color %_Yellow% "Mismatch found [WMI-%osedition%] [Reg-%regedition%].""
set "showeditionerror=call :dk_color %_Yellow% "[%osedition%] [Reg-%regedition%].""
)
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "dismedition=%%a"
if not defined dismedition set dismnotworking=1
set branch=
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildBranch %nul6%') do set "branch=%%b"
@ -388,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! "
@ -501,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
)
@ -783,12 +802,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -798,6 +820,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
@ -825,14 +848,14 @@ if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call RefreshLicenseStatus
if %_wmic% EQU 0 %psc% "$null=(([WMICLASS]'%sps%').GetInstances()).RefreshLicenseStatus()" %nul%
exit /b
:: Get installed products Activation IDs
:: Get all products Activation IDs
:dk_actid
:dk_actids
set apps=
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1' and PartialProductKey is not null) get ID /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1'' AND PartialProductKey IS NOT NULL').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
%chkapp% do (if defined apps (call set "apps=!apps! %%a") else (call set "apps=%%a"))
set allapps=
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
exit /b
:: Get Edition list
@ -867,7 +890,7 @@ echo sc start sppsvc [Error Code: %spperror%]
)
echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
exit /b
:: Common lines used in PowerShell reflection code
@ -987,6 +1010,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
@ -1267,11 +1291,15 @@ if (!$Dism::_DismSetEdition($Session, "$TargetEdition", "$Key", 0, 0, 0)) {
:: Separator = _
:: For Windows 10/11 editions, HWID key is listed where ever possible, in Server versions, KMS key is listed where ever possible.
:: Only RS3 and older version Generic keys are stored here, later ones are extracted from the pkeyhelper.dll itself
:: For Windows, generic keys are mentioned till 22000 and for Server, generic keys are mentioned till 17763, later ones are extracted from the pkeyhelper.dll
:changeeditiondata
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
if %winbuild% GTR 17763 exit /b
) else (
if %winbuild% GEQ 22000 exit /b
)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=)
set h=
@ -1289,8 +1317,12 @@ YTMG3-N6DKC-DKB77-7M9GH-8HV%h%X7______Retail_Core
XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education
84NGF-MHBT6-FXBX8-QWJK7-DRR%h%8H______Retail_EducationN
KCNVH-YKWX8-GJJB9-H9FDT-6F7%h%W2__Volume:MAK_EnterpriseS_VB
43TBQ-NH92J-XKTM7-KT3KK-P39%h%PB__OEM:NONSLP_EnterpriseS_RS5
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1
FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%h%PT__Volume:MAK_EnterpriseSN_VB
M33WV-NHY3C-R7FPM-BQGPT-239%h%PG__Volume:MAK_EnterpriseSN_RS5
2DBW3-N2PJG-MVHW3-G7TDK-9HK%h%R4__Volume:MAK_EnterpriseSN_RS1
NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH
G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage
@ -1302,6 +1334,10 @@ GJTYN-HDMQY-FRR76-HVGC7-QPF%h%8P______Retail_ProfessionalEducationN
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN
NJCF7-PW8QT-3324D-688JX-2YV%h%66______Retail_ServerRdsh
XQQYW-NFFMW-XJPBH-K8732-CKF%h%FD______OEM:DM_IoTEnterprise
QPM6N-7J2WJ-P88HH-P3YRH-YY7%h%4H__OEM:NONSLP_IoTEnterpriseS
K9VKN-3BGWV-Y624W-MCRMQ-BHD%h%CD______Retail_CloudEditionN
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%h%4W______Retail_CloudEdition
V3WVW-N2PV2-CGWC3-34QGF-VMJ%h%2C______Retail_Cloud
NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN
2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE

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.7
@set masver=3.0
@echo off
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -67,7 +69,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -103,6 +105,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1
@ -118,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%].
@ -159,15 +173,16 @@ goto done2
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -215,6 +230,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -240,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 (
@ -258,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)
)
)
@ -299,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=
@ -307,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
)
@ -332,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
@ -428,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
@ -526,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
@ -554,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
@ -636,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:
::========================================================================================================================================
@ -692,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 ______________________________________________________________
@ -701,6 +681,7 @@ echo ______________________________________________________________
echo:
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
@ -729,12 +710,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -744,6 +728,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""

View File

@ -1,4 +1,4 @@
@set masver=2.7
@set masver=3.0
@echo off
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0"
for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1
if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1
)
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
exit /b
)
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
exit /b
)
@ -67,7 +69,7 @@ echo:
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
echo Help - %mas%fix_service
echo:
echo:
ping 127.0.0.1 -n 20
@ -103,6 +105,8 @@ set _unattended=0
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1
@ -119,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%].
@ -160,15 +174,16 @@ goto dk_done
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -216,6 +231,7 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -241,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 (
@ -259,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)
)
)
@ -593,7 +613,7 @@ echo [Successful]
echo:
echo Restarting wlidsvc ^& LicenseManager services...
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
::========================================================================================================================================
@ -784,14 +804,6 @@ echo:
call :dk_color %Blue% "Repairing Office licenses..."
echo:
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b
if /i "%arch%"=="x86" (
set arch=X86
) else (
set arch=X64
)
for %%# in (68 86) do (
for %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%%#=)
)
@ -809,10 +821,10 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v P
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & call :getc2rrepair c2r16repair86 OfficeClickToRun.exe)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & call :getc2rrepair c2r16repair68 OfficeClickToRun.exe)
set uwp16=
if %winbuild% GEQ 10240 (
@ -873,11 +885,8 @@ pause %nul1%
if defined uwp16 (
echo:
echo Note: Skipping repair for Office 16.0 UWP...
echo You need to use the Reset option in Windows Settings instead.
echo ________________________________________________________________
echo Skipping repair for Office 16.0 UWP...
echo:
start ms-settings:appsfeatures
)
set c2r14=
@ -886,11 +895,8 @@ if defined c2r14_86 set c2r14=1
if defined c2r14 (
echo:
echo Note: Skipping repair for Office 14.0 C2R...
echo You need to use the Repair option in Windows Settings for it.
echo ________________________________________________________________
echo Skipping repair for Office 14.0 C2R...
echo:
start appwiz.cpl
)
if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
@ -913,6 +919,15 @@ echo:
call :dk_color %Green% "Finished"
goto :at_back
:getc2rrepair
for %%# in (X86 X64) do (
if exist "%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2" (
set "%1=%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2"
)
)
exit /b
:getrepairsetup
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
@ -1077,7 +1092,7 @@ if %errorlevel% NEQ 0 (set error=1& exit /b)
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM SoftwareLicensingService').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
cmd /c exit /b %errorlevel%
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440" %nul1%
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440 0x80131501" %nul1%
if %errorlevel% EQU 0 set error=1
exit /b
@ -1138,6 +1153,8 @@ exit /b
set permerror=
if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder"
if defined ps32onArm exit /b
for %%# in (
"%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -1381,6 +1398,7 @@ $key.SetAccessControl($acl)
echo:
if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
@ -1429,12 +1447,15 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
@ -1444,6 +1465,7 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""

View File

@ -2,13 +2,7 @@
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="center">A Windows and Office activator using HWID / Ohook / KMS38 / Online KMS activation methods, with a focus on open-source code and fewer antivirus detections.</p>
<p align="center">
<a href="https://discord.gg/tVFN4N84PP"><img src="https://img.shields.io/badge/Chat%20with%20us%20on%20Discord--blue?style=social&logo=discord" alt="Chat with us without signup" title="Chat with us without signup"></a>
<a href="https://www.reddit.com/r/MAS_Activator"><img src="https://img.shields.io/badge/MAS%20on%20Reddit--orange?style=social&logo=reddit" alt="MAS on Reddit" title="MAS on Reddit"></a>
<a href="https://twitter.com/massgravel"><img src="https://img.shields.io/twitter/follow/massgravel" alt="Follow us on X" title="Follow us on X"></a>
</p>
<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>
@ -21,42 +15,95 @@
```
irm https://get.activated.win | iex
```
or (deprecated, will be retired on Dec 31 2024, use above instead)
Alternatively, you can use the following (It will be deprecated in the future.)
```
irm https://massgrave.dev/get | iex
```
3. You will see the activation options. Choose [1] HWID for Windows activation. Choose [2] Ohook for Office activation.
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
4. That's all.
---
- On older Windows builds you may need to run the below command before,
`[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12`
- The Powershell method does not work on Windows 7. Use the Method 2 - Traditional instead.
- The URL get.activated.win may be blocked by some DNS services because it is a new domain.
### Method 2 - Traditional (Windows 7 and later)
1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) / [Azure DevOps](https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts) / [Self-hosted Git](https://git.activated.win/massgrave/Microsoft-Activation-Scripts)
<details>
<summary>Click here for info</summary>
1. Download the file using the links provided below.
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
or
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
2. Right-click on the downloaded zip file and extract
3. In the extracted folder, find the folder named `All-In-One-Version`
4. Run the file named `MAS_AIO.cmd`
5. You will see the activation options, follow the on-screen instructions.
6. That's all.
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches)
</details>
</br>
---
### 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.
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
---
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
```
Latest Version: 2.7
Release date: 6-Sep-2024
Latest Version: 3.0
Release date: 14-Feb-2025
```
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
<div align="center">
[![1.1]][1]
[![1.2]][2]
[![1.3]][3]
</div>
<div align="center">
[![1.4]][4]
[![1.5]][5]
[![1.6]][6]
[![1.7]][7]
</div>
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
[4]: https://discord.gg/j2yFsV5ZVC
[5]: https://www.reddit.com/r/MAS_Activator
[6]: https://bsky.app/profile/massgrave.dev
[7]: https://twitter.com/massgravel
---
<p align="center">Made with Love ❤️</p>