45 Commits

Author SHA1 Message Date
WindowsAddict
be7d101df5 Merge branch 'dev' 2025-06-01 20:57:31 +05:30
WindowsAddict
55b6fce50a Update readme 2025-06-01 20:46:56 +05:30
WindowsAddict
6566bb53c1 export-ignore 2025-06-01 20:31:23 +05:30
WindowsAddict
2e44a4a77b 3.3 2025-06-01 20:30:48 +05:30
WindowsAddict
9073a35fe0 Add StaticCID and KMS4k method in TSforge 2025-06-01 20:27:57 +05:30
WindowsAddict
9f244ddc17 Fix grammar 2025-05-27 22:10:02 +05:30
WindowsAddict
8ed0c6874b Suggest TSforge for Office where Windows is not supposed to get feature upgrades 2025-05-27 22:04:35 +05:30
WindowsAddict
a99acbb025 Update Powershell error detection code 2025-05-27 20:43:23 +05:30
WindowsAddict
be867f6616 Update links 2025-05-27 19:32:44 +05:30
WindowsAddict
fc80735dac Improve fix info in the script 2025-05-25 00:38:43 +05:30
WindowsAddict
69c469a997 Update old Office version detection with subscription license 2025-05-23 18:56:14 +05:30
WindowsAddict
6e74d49721 Minor fix 2025-05-23 18:20:53 +05:30
WindowsAddict
ae93f547f5 Add the option to change Office update channel to VL and from VL to retail 2025-05-23 17:54:17 +05:30
WindowsAddict
830755f6b6 Fix an issue in detecting Office preview licenses in TSforge 2025-05-18 18:11:04 +05:30
WindowsAddict
a149fc5f20 Change hash 2025-05-18 13:08:08 +05:30
WindowsAddict
b75ba72bc5 Change hash 2025-05-18 12:52:40 +05:30
WindowsAddict
206c31ece5 Open mirror pages along with massgrave.dev 2025-05-18 12:09:25 +05:30
WindowsAddict
133d3b9720 Edit the info related to Mondo conversion 2025-05-18 10:46:12 +05:30
WindowsAddict
fc2348bf53 Add some info related to O365 to Mondo conversion in TSforge 2025-05-18 03:39:29 +05:30
WindowsAddict
966fbd14f6 Don't ask to run other fixes if file infector malware is detected 2025-05-18 02:47:41 +05:30
WindowsAddict
691e6088d5 Use user temp folder or random name in Windows/Temp 2025-05-18 02:41:47 +05:30
WindowsAddict
74b7c74218 Continue to activate in case of errors 2025-05-18 01:40:41 +05:30
WindowsAddict
4c53e6231b Fix Microsoft links 2025-05-08 05:31:04 +05:30
WindowsAddict
2d00dfa704 Revert export-ignore 2025-05-06 23:10:58 +05:30
WindowsAddict
bf28e4fbdd export-ignore 2025-05-06 22:37:54 +05:30
WindowsAddict
2a2352428e 3.2 2025-05-06 22:36:13 +05:30
WindowsAddict
be9215b728 Fix goback button in change Office edition script 2025-05-06 20:01:06 +05:30
WindowsAddict
93cf3864f5 Directly go back when asked to press key to ignore opening support page 2025-05-06 19:53:15 +05:30
WindowsAddict
d47a750bad Detect Powershell 1.0 on Server 2008 and ask to install Powershell 2.0 2025-05-06 19:29:19 +05:30
WindowsAddict
817bfe84de Don't ask to run SFC scan if malware is found 2025-05-06 18:26:33 +05:30
WindowsAddict
2b40259b33 Add fixes for CAS 2025-05-06 18:09:33 +05:30
WindowsAddict
a514a99d0e Update an error message in KMS script 2025-05-06 17:47:27 +05:30
WindowsAddict
2a806c2e0c Fix ARM32 Office detection 2025-05-06 17:39:26 +05:30
WindowsAddict
b3aaff5110 Update Windows 7 ESU 4-6y info 2025-05-06 17:14:27 +05:30
WindowsAddict
bcc4214e8a Add O365AppsBasicRetail conversion in KMS script 2025-05-05 22:38:51 +05:30
WindowsAddict
9e80556df5 Add O365AppsBasicRetail support 2025-05-05 22:25:54 +05:30
WindowsAddict
b24bb9bde1 Remove () from product name 2025-05-04 17:04:06 +05:30
WindowsAddict
dfebdefeba Add Office 2010 Publisher Retail key 2025-05-04 02:21:50 +05:30
WindowsAddict
1bdee1ce6f Improve edition package detection 2025-05-04 01:03:13 +05:30
WindowsAddict
4e702068be Revert export-ignore 2025-04-29 23:06:43 +05:30
WindowsAddict
6945236590 Merge branch 'dev' 2025-04-29 22:45:01 +05:30
WindowsAddict
5872b7df53 3.1
Added Ohook support for OSPP based Office on Vista and later
2025-04-29 22:40:56 +05:30
WindowsAddict
b8ad749bac Fix issue related to URL opening in unattended mode 2025-04-21 20:22:13 +05:30
WindowsAddict
5090cde0a0 Use wmic.exe on builds below 9200 2025-04-21 18:01:09 +05:30
WindowsAddict
313f240448 Change file hash 2025-03-14 15:30:16 +05:30
13 changed files with 3968 additions and 1474 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=3.0
@set masver=3.3
@echo off
@@ -100,6 +100,8 @@ set "nul="
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -239,12 +241,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -274,7 +278,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -356,7 +366,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
@@ -381,11 +391,13 @@ if not exist %SysPath%\%%# (
%eline%
echo [%SysPath%\%%#] file is missing, aborting...
echo:
if not defined results (
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
call :dk_color %Blue% "After that, restart system and try activation again."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
)
goto dk_done
)
)
@@ -541,6 +553,7 @@ call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script w
echo:
)
set generickey=1
call :dk_inskey "[%key%]"
::========================================================================================================================================
@@ -960,11 +973,12 @@ set keyerror=%errorlevel%
cmd /c exit /b %keyerror%
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ")
if %keyerror% EQU 0 (
if %sps%==SoftwareLicensingService call :dk_refresh
echo Installing Generic Product Key %~1 [Successful]
echo %keyecho% %~1 [Successful]
) else (
call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%"
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
if not defined error (
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
call :dk_color %Blue% "%_fixmsg%"
@@ -973,6 +987,7 @@ set showfix=1
set error=1
)
set generickey=
exit /b
:: Activation command
@@ -1072,6 +1087,7 @@ function ReinstallLicenses() {
:dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@@ -1099,7 +1115,7 @@ exit /b
:dk_product
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%')
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, ''
set winos=
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
@@ -1109,10 +1125,6 @@ if %winbuild% GEQ 22000 (
set winos=!winos:Windows 10=Windows 11!
)
)
if %winbuild% LSS 7600 (
set "winos=!winos:VistaT=Vista!"
set "winos=!winos:Serverr=Server!"
)
if not defined winsub exit /b
@@ -1169,7 +1181,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
if defined results (call :dk_color %Red% "%results%"&set showfix=1)
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
@@ -1308,7 +1320,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
:: https://learn.microsoft.com/en-us/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)
@@ -1379,13 +1391,16 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
)
)
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
@@ -1576,7 +1591,7 @@ set "permerror=Error Found In SPP Registries"
)
)
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
@@ -1701,7 +1716,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -103,6 +103,8 @@ set "nul="
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -242,12 +244,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -277,7 +281,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -359,7 +369,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
cls
@@ -421,11 +431,13 @@ if defined _fmiss (
%eline%
echo [%_fmiss%] file is missing, aborting...
echo:
if not defined results (
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
call :dk_color %Blue% "After that, restart system and try activation again."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
)
goto dk_done
)
@@ -620,6 +632,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [
)
if defined key (
set generickey=1
call :dk_inskey "[%key%]"
)
@@ -718,12 +731,6 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
%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]
) || (
call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
)
%_xmlexist% (
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
%_xmlexist% timeout /t 2 %nul%
@@ -1085,11 +1092,12 @@ set keyerror=%errorlevel%
cmd /c exit /b %keyerror%
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ")
if %keyerror% EQU 0 (
if %sps%==SoftwareLicensingService call :dk_refresh
echo Installing Generic Product Key %~1 [Successful]
echo %keyecho% %~1 [Successful]
) else (
call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%"
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
if not defined error (
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
call :dk_color %Blue% "%_fixmsg%"
@@ -1098,6 +1106,7 @@ set showfix=1
set error=1
)
set generickey=
exit /b
:: Get Windows installed key channel
@@ -1176,6 +1185,7 @@ function ReinstallLicenses() {
:dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@@ -1203,7 +1213,7 @@ exit /b
:dk_product
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%')
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, ''
set winos=
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
@@ -1213,10 +1223,6 @@ if %winbuild% GEQ 22000 (
set winos=!winos:Windows 10=Windows 11!
)
)
if %winbuild% LSS 7600 (
set "winos=!winos:VistaT=Vista!"
set "winos=!winos:Serverr=Server!"
)
if not defined winsub exit /b
@@ -1318,7 +1324,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
if defined results (call :dk_color %Red% "%results%"&set showfix=1)
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
@@ -1457,7 +1463,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
:: https://learn.microsoft.com/en-us/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)
@@ -1528,13 +1534,16 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
)
)
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
@@ -1725,7 +1734,7 @@ set "permerror=Error Found In SPP Registries"
)
)
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
@@ -1850,7 +1859,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -100,6 +100,8 @@ set "nul="
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -171,12 +173,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done
)
if %winbuild% LSS 9200 (
%eline%
if %winbuild% LSS 6001 (
%nceline%
echo Unsupported OS version detected [%winbuild%].
echo Ohook Activation is supported only on Windows 8/10/11 and their server equivalents.
echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents.
if %winbuild% EQU 6000 (
echo:
call :dk_color %Blue% "Use Online KMS activation option instead."
echo Windows Vista RTM is not supported because Powershell cannot be installed.
echo Upgrade to Windows Vista SP1 or SP2.
)
goto dk_done
)
if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
%nceline%
if not exist %ps% (
echo PowerShell is not installed in your system.
)
echo Install PowerShell 2.0 using the following URL.
echo:
echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
goto dk_done
)
@@ -232,12 +249,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -267,7 +286,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -349,7 +374,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
cls
@@ -398,8 +423,8 @@ goto :oh_menu
cls
if not defined terminal (
mode 130, 32
if exist "%SysPath%\spp\store_test\" mode 134, 32
mode 140, 32
if exist "%SysPath%\spp\store_test\" mode 140, 32
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
)
title Ohook Activation %masver%
@@ -408,15 +433,17 @@ echo:
echo Initializing...
call :dk_chkmal
if not exist %SysPath%\sppsvc.exe (
if not exist %SysPath%\%_slexe% (
%eline%
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
echo [%SysPath%\%_slexe%] file is missing, aborting...
echo:
if not defined results (
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
call :dk_color %Blue% "After that, restart system and try activation again."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
)
goto dk_done
)
@@ -442,7 +469,7 @@ call :dk_showosinfo
echo Initiating Diagnostic Tests...
set "_serv=sppsvc Winmgmt"
set "_serv=%_slser% Winmgmt"
:: Software Protection
:: Windows Management Instrumentation
@@ -451,16 +478,15 @@ set notwinact=1
set ohookact=1
call :dk_errorcheck
call :oh_setspp
:: Check unsupported office versions
set o14msi=
set o14c2r=
set o16uwp=
set _68=HKLM\SOFTWARE\Microsoft\Office
set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI )
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI )
%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
@@ -468,10 +494,10 @@ 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%"=="" (
if not "%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."
call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%%o16uwp%]"
if not "%o16uwp%"=="" call :dk_color %Blue% "Use TSforge option to activate it."
)
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
@@ -502,10 +528,10 @@ set o15c2r=
set error=1
)
if "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="" (
if "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" (
set error=1
echo:
if not "%o14msi%%o14c2r%%o16uwp%"=="" (
if not "%o14c2r%%o16uwp%"=="" (
call :dk_color %Red% "Checking Supported Office Install [Not Found]"
) else (
call :dk_color %Red% "Checking Installed Office [Not Found]"
@@ -513,7 +539,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]"
if defined ohub (
echo:
echo You only have the Office dashboard app installed, you need to install the full version of Office.
echo You only have the Office Dashboard app installed. You need to install the full version of Office.
)
echo:
call :dk_color %Blue% "Download and install Office from the below URL and then try again."
@@ -524,8 +550,8 @@ goto dk_done
)
set multioffice=
if not "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="1" set multioffice=1
if not "%o14msi%%o14c2r%%o16uwp%"=="" set multioffice=1
if not "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1
if not "%o14c2r%%o16uwp%"=="" set multioffice=1
if defined multioffice (
call :dk_color %Gray% "Checking Multiple Office Install [Found, its recommended to install only one version]"
@@ -569,12 +595,8 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe"
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 /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"
)
call :oh_ppcpath
echo:
echo Activating Office... [C2R ^| %_version% ^| %_oArch%]
@@ -585,9 +607,20 @@ set error=1
goto :starto16c2r
)
if defined noOsppc (
call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]"
call :dk_color %Blue% "%_fixmsg%"
set error=1
goto :starto16c2r
)
call :oh_fixprids
call :oh_process
if defined isOspp (
call :oh_hookinstall_ospp
) else (
call :oh_hookinstall
)
::========================================================================================================================================
@@ -619,12 +652,8 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe"
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 /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"
)
call :oh_ppcpath
echo:
echo Activating Office... [C2R ^| %_version% %_AudienceData%^| %_oArch%]
@@ -635,18 +664,29 @@ set error=1
goto :startmsi
)
if defined noOsppc (
call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]"
call :dk_color %Blue% "%_fixmsg%"
set error=1
goto :startmsi
)
call :oh_fixprids
call :oh_process
if defined isOspp (
call :oh_hookinstall_ospp
) else (
call :oh_hookinstall
)
::========================================================================================================================================
:: Old version (16.0.9xxxx and below) of Office with subscription license key may show a banner to sign in to fix license issue.
:: Old version of Office with subscription license key may show a banner to sign in to fix license issue.
:: Although script applies a Resiliency registry entry to fix that but it doesn't work on old office versions.
:: Below code checks that condition and informs the user to update the Office.
if defined _sublic (
if not exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
if not exist "%_oLPath%\Word2021VL_KMS_Client_AE*.xrm-ms" (
call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Office, otherwise, it may show a licensing issue-related banner.]"
)
)
@@ -674,6 +714,9 @@ echo Adding a Registry to Prevent Banner [Successful]
:startmsi
if defined o14msi call :oh_setspp 14
if defined o14msi call :oh_processmsi 14 %o14msi_reg%
call :oh_setspp
if defined o15msi call :oh_processmsi 15 %o15msi_reg%
if defined o16msi call :oh_processmsi 16 %o16msi_reg%
@@ -705,7 +748,7 @@ goto :dk_done
:oh_uninstall
cls
if not defined terminal mode 99, 32
if not defined terminal mode 145, 32
title Uninstall Ohook Activation %masver%
set _present=
@@ -721,6 +764,7 @@ if defined o16c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg
if defined o15c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o15c2r_reg% /v InstallPath" %nul6%') do (set "_15CHook=%%b\root\vfs"))
if defined o16msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_16MHook=%%b"))
if defined o15msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o15msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_15MHook=%%b"))
if defined o14msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o14msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_14MHook=%%b"))
if defined _16CHook (if exist "%_16CHook%\System\sppc*dll" (set _present=1& del /s /f /q "%_16CHook%\System\sppc*dll" & if exist "%_16CHook%\System\sppc*dll" set _unerror=1))
if defined _16CHook (if exist "%_16CHook%\SystemX86\sppc*dll" (set _present=1& del /s /f /q "%_16CHook%\SystemX86\sppc*dll" & if exist "%_16CHook%\SystemX86\sppc*dll" set _unerror=1))
@@ -728,8 +772,9 @@ if defined _15CHook (if exist "%_15CHook%\System\sppc*dll" (set _present=1& d
if defined _15CHook (if exist "%_15CHook%\SystemX86\sppc*dll" (set _present=1& del /s /f /q "%_15CHook%\SystemX86\sppc*dll" & if exist "%_15CHook%\SystemX86\sppc*dll" set _unerror=1))
if defined _16MHook (if exist "%_16MHook%sppc*dll" (set _present=1& del /s /f /q "%_16MHook%sppc*dll" & if exist "%_16MHook%sppc*dll" set _unerror=1))
if defined _15MHook (if exist "%_15MHook%sppc*dll" (set _present=1& del /s /f /q "%_15MHook%sppc*dll" & if exist "%_15MHook%sppc*dll" set _unerror=1))
if defined _14MHook (if exist "%_14MHook%sppc*dll" (set _present=1& del /s /f /q "%_14MHook%sppc*dll" & if exist "%_14MHook%sppc*dll" set _unerror=1))
for %%# in (15 16) do (
for %%# in (14 15 16) do (
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" (set _present=1& del /s /f /q "%%~A\Microsoft Office\Office%%#\sppc*dll" & if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set _unerror=1)
)
@@ -743,6 +788,31 @@ if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" (set _present=1& del /s /f
)
)
::==================================
for %%# in (OSPPC.DLL sppcs.dll) do (
for %%A in ("%CommonProgramFiles%" "%CommonProgramW6432%" "%CommonProgramFiles(x86)%") do (
for %%G in ("%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\%%#") do (
set size=0
set size=%%~zG
if !size! GEQ 1 if !size! LSS 100000 (
set _present=1
del /f /q "%%~G"
if exist "%%~G" (move /y "%%~G" "!_ttemp!\needsToBeDeleted%random%" %nul%)
if exist "%%~G" (set _unerror=1) else (echo Deleted file - %%~G)
)
if /i sppcs.dll==%%# if !size! GEQ 100000 (
move /y "%%~G" "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" %nul%
if exist "%%~G" (move /y "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" "!_ttemp!\needsToBeDeleted%random%" %nul%)
move /y "%%~G" "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" %nul%
if exist "%%~G" (set _unerror=1&echo Failed to rename sppcs.dll back to "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL") else (echo Renamed sppcs.dll back to "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL")
)
)
)
)
::==================================
reg query HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && (
echo:
echo Deleting - Registry keys for skipping license check
@@ -772,6 +842,8 @@ reg unload HKU\%%# %nul%
)
)
::==================================
set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663"
reg query "%kmskey%" %nul% && (
echo:
@@ -818,6 +890,7 @@ set _oLPath=
set _hookPath=
set _hook=
set _sppcPath=
set _osppPath=
set _actid=
set _prod=
set _lic=
@@ -836,6 +909,7 @@ set o16c2r=
set o15c2r=
set o16msi=
set o15msi=
set o14msi=
set _68=HKLM\SOFTWARE\Microsoft\Office
set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
@@ -845,10 +919,56 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %
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 o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun)
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 o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun)
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 o16msi=1&set o16msi_reg=%_86%\16.0)
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 o16msi=1&set o16msi_reg=%_68%\16.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0)
exit /b
::========================================================================================================================================
:oh_ppcpath
if not defined isOspp (
if not "%osarch%"=="x86" (
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"
)
)
set noOsppc=
set _hook68=
set _hook86=
set _osppPath68=
set _osppPath86=
if defined isOspp (
if not "%osarch%"=="x86" (
if /i "%_oArch%"=="x64" (
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath68=%%b")
if not exist "!_osppPath68!OSPPC.DLL" set noOsppc=1
)
if /i "%_oArch%"=="x86" (
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath68=%%b")
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath86=%%b")
if not exist "!_osppPath68!OSPPC.DLL" set noOsppc=1
if not exist "!_osppPath86!OSPPC.DLL" set noOsppc=1
)
) else (
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath86=%%b")
if not exist "!_osppPath86!OSPPC.DLL" set noOsppc=1
)
if "!_osppPath68:~-1!"=="\" set "_osppPath68=!_osppPath68:~0,-1!"
if "!_osppPath86:~-1!"=="\" set "_osppPath86=!_osppPath86:~0,-1!"
)
if defined _osppPath68 set _hook68=sppc64.dll
if defined _osppPath86 set _hook86=sppc32.dll
exit /b
@@ -944,15 +1064,24 @@ set hasherror=
if %_hook%==sppc32.dll set offset=2564
if %_hook%==sppc64.dll set offset=3076
del /s /q "%_hookPath%\sppcs.dll" %nul%
del /s /q "%_hookPath%\sppc.dll" %nul%
::======================================
if exist "%_hookPath%\sppcs.dll" set "ierror=Remove Previous Ohook Install"
if exist "%_hookPath%\sppc.dll" set "ierror=Remove Previous Ohook Install"
:: Remove previous Install
for %%# in (sppcs.dll sppc.dll) do (
del /f /q "%_hookPath%\%%#" %nul%
if exist "%_hookPath%\%%#" (move /y "%_hookPath%\%%#" "!_ttemp!\needsToBeDeleted%random%" %nul%)
if exist "%_hookPath%\%%#" (set "ierror=Remove Previous Ohook Install [%%#]")
)
if defined ierror goto :oh_hookinstall_error
::======================================
mklink "%_hookPath%\sppcs.dll" "%_sppcPath%" %nul%
if not %errorlevel%==0 (
if not defined ierror set ierror=mklink
if not exist "%_hookPath%\sppcs.dll" (
set ierror=mklink sppcs.dll
goto :oh_hookinstall_error
)
set exhook=
@@ -967,17 +1096,122 @@ popd
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
)
)
if not exist "%_hookPath%\sppc.dll" (if not defined ierror set ierror=Copy)
if not exist "%_hookPath%\sppc.dll" (
set ierror=Copy
goto :oh_hookinstall_error
)
echo:
if not defined ierror (
echo Symlinking System's sppc.dll to ["%_hookPath%\sppcs.dll"] [Successful]
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
if defined exhook (
echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
) else (
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
)
goto :oh_hookinstall_error
::========================================================================================================================================
:oh_hookinstall_ospp
set ierror=
set hasherror=
if defined _hook86 set offset86=2564
if defined _hook68 set offset68=3076
::======================================
:: Remove previous Install
for %%# in (OSPPC.DLL sppcs.dll) do (
for %%A in ("%_osppPath68%\%%#" "%_osppPath86%\%%#") do (
set size=0
set size=%%~zA
if !size! GEQ 1 if !size! LSS 100000 (
del /f /q "%%~A" %nul%
if exist "%%~A" (move /y "%%~A" "!_ttemp!\needsToBeDeleted%random%" %nul%)
if exist "%%~A" (set "ierror=Remove Previous Ohook Install [%%#]")
)
)
)
if defined ierror goto :oh_hookinstall_error
for %%A in ("%_osppPath68%" "%_osppPath86%") do (
if exist "%%~A\sppcs.dll" (move /y "%%~A\sppcs.dll" "%%~A\OSPPC.DLL" %nul%)
if exist "%%~A\sppcs.dll" (
move /y "%%~A\OSPPC.DLL" "!_ttemp!\needsToBeDeleted%random%" %nul%
move /y "%%~A\sppcs.dll" "%%~A\OSPPC.DLL" %nul%
)
if exist "%%~A\sppcs.dll" (set "ierror=Move sppcs.dll back to OSPPC.DLL")
)
del /f /q "%_hookPath%\sppcs.dll" %nul%
if exist "%_hookPath%\sppcs.dll" (move /y "%_hookPath%\sppcs.dll" "!_ttemp!\needsToBeDeleted%random%" %nul%)
if exist "%_hookPath%\sppcs.dll" (set "ierror=Remove Previous Ohook mklink sppcs.dll")
if defined ierror goto :oh_hookinstall_error
::======================================
if defined _osppPath68 (move /y "%_osppPath68%\OSPPC.DLL" "%_osppPath68%\sppcs.dll" %nul% & if not exist "%_osppPath68%\sppcs.dll" set ierror=1)
if defined _osppPath86 (move /y "%_osppPath86%\OSPPC.DLL" "%_osppPath86%\sppcs.dll" %nul% & if not exist "%_osppPath86%\sppcs.dll" set ierror=1)
if defined ierror (
set "ierror=Rename OSPPC.DLL"
goto :oh_hookinstall_error
)
if defined _osppPath68 if defined _osppPath86 (mklink "%_hookPath%\sppcs.dll" "%_osppPath86%\sppcs.dll" %nul%)
if defined _osppPath68 if not defined _osppPath86 (mklink "%_hookPath%\sppcs.dll" "%_osppPath68%\sppcs.dll" %nul%)
if defined _osppPath86 if not defined _osppPath68 (mklink "%_hookPath%\sppcs.dll" "%_osppPath86%\sppcs.dll" %nul%)
if not exist "%_hookPath%\sppcs.dll" (
set ierror=mklink sppcs.dll
goto :oh_hookinstall_error
)
set exhook=
if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1
if defined exhook (
pushd "!_work!\BIN\"
if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%)
if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%)
popd
) else (
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
)
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
if defined ierror (
set ierror=Copy
goto :oh_hookinstall_error
)
echo:
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
if defined exhook (
if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
) else (
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
)
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
::========================================================================================================================================
:oh_hookinstall_error
if defined ierror (
set error=1
call :dk_color %Red% "Installing Ohook [Failed to %ierror%]"
echo:
@@ -996,9 +1230,9 @@ if not defined exhook if not defined ierror (
if defined hasherror (
set error=1
set ierror=1
call :dk_color %Red% "Modifying Hash of Custom %_hook% [Failed]"
call :dk_color %Red% "Modifying Hash of Custom sppcs.dll [Failed]"
) else (
echo Modifying Hash of Custom %_hook% [Successful]
echo Modifying Hash of Custom sppcs.dll [Successful]
)
)
@@ -1006,6 +1240,26 @@ exit /b
::========================================================================================================================================
:oh_setspp
set isOspp=
if %winbuild% GEQ 9200 (
set spp=SoftwareLicensingProduct
set sps=SoftwareLicensingService
) else (
set isOspp=1
set spp=OfficeSoftwareProtectionProduct
set sps=OfficeSoftwareProtectionService
)
if "%1"=="14" (
set isOspp=1
set spp=OfficeSoftwareProtectionProduct
set sps=OfficeSoftwareProtectionService
)
exit /b
::========================================================================================================================================
:oh_process
for %%# in (%_oIds%) do (
@@ -1025,10 +1279,11 @@ call :ohookdata getinfo !_prod!
if not "!key!"=="" (
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
if not %oVer%==14 set generickey=1
call :dk_inskey "[!key!] [!_prod!] [!_lic!]"
) else (
set error=1
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! key not found in script]"
call :dk_color %Blue% "Make sure you are using the latest version of MAS."
set fixes=%fixes% %mas%
call :dk_color %_Yellow% "%mas%"
@@ -1055,7 +1310,11 @@ exit /b
:: Process Office MSI Version
call :oh_reset
if "%1"=="14" (
call :dk_actids 59a52881-a989-479d-af46-f275c6370663
) else (
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
)
set oVer=%1
for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\InstallRoot /v Path" %nul6%') do (set "_oRoot=%%b")
@@ -1068,16 +1327,8 @@ if "%osarch%"=="x86" set _oArch=x86
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 /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"
)
set "_common=%CommonProgramFiles%"
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
set "_common2=%CommonProgramFiles(x86)%"
call :oh_ppcpath
call :msiofficedata %2
@@ -1090,8 +1341,23 @@ call :dk_color %Red% "Checking Installed Products [Product IDs not f
exit /b
)
if defined noOsppc (
call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]"
call :dk_color %Blue% "%_fixmsg%"
set error=1
exit /b
)
if %oVer%==14 if defined SingleImage (
echo Checking Installed Products [SingleImage product found, Professional Retail key will be used for activation]
)
call :oh_process
if defined isOspp (
call :oh_hookinstall_ospp
) else (
call :oh_hookinstall
)
exit /b
@@ -1100,7 +1366,7 @@ exit /b
:oh_clearblock
:: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state
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))
@@ -1196,12 +1462,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
)
:: Clear device-based-licensing
:: https://learn.microsoft.com/deployoffice/device-based-licensing
:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing
for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
:: Remove OEM registry key
:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
for %%# in (15 16) do (
reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul%
@@ -1415,11 +1681,12 @@ set keyerror=%errorlevel%
cmd /c exit /b %keyerror%
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ")
if %keyerror% EQU 0 (
if %sps%==SoftwareLicensingService call :dk_refresh
echo Installing Generic Product Key %~1 [Successful]
echo %keyecho% %~1 [Successful]
) else (
call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%"
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
if not defined error (
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
call :dk_color %Blue% "%_fixmsg%"
@@ -1428,6 +1695,7 @@ set showfix=1
set error=1
)
set generickey=
exit /b
:: Get all products Activation IDs
@@ -1443,9 +1711,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
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%
echo:!allapps!> "!_ttemp!\chklen"
for %%A in ("!_ttemp!\chklen") do (set len=%%~zA)
del "!_ttemp!\chklen" %nul%
if !len! GTR 6000 (
%eline%
@@ -1495,6 +1763,7 @@ function ReinstallLicenses() {
:dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@@ -1522,7 +1791,7 @@ exit /b
:dk_product
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%')
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, ''
set winos=
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
@@ -1532,10 +1801,6 @@ if %winbuild% GEQ 22000 (
set winos=!winos:Windows 10=Windows 11!
)
)
if %winbuild% LSS 7600 (
set "winos=!winos:VistaT=Vista!"
set "winos=!winos:Serverr=Server!"
)
exit /b
@@ -1577,7 +1842,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
if defined results (call :dk_color %Red% "%results%"&set showfix=1)
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
@@ -1716,7 +1981,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
:: https://learn.microsoft.com/en-us/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)
@@ -1787,13 +2052,16 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
)
)
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
@@ -1984,7 +2252,7 @@ set "permerror=Error Found In SPP Registries"
)
)
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
@@ -2109,7 +2377,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (
@@ -2126,15 +2395,69 @@ exit /b
:: 1st column = Office version number
:: 2nd column = Activation ID
:: 3rd column = Generic key. Preference is given in this order, Retail:TB:Sub > Retail > OEM:NONSLP > Volume:MAK > Volume:GVLK
:: 3rd column = For Office 2013 and later, the generated keys are listed. For Office 2010, the blocked keys sourced from the Internet are listed.
:: For Office 2013 and later, key preference is given in this order, Retail:TB:Sub > Retail > OEM:NONSLP > Volume:MAK > Volume:GVLK
:: For Office 2010, key preference is given in this order, Retail > Volume:MAK
:: 4th column = Last part of license description
:: 5th column = Edition
:: 6th column = Other Edition IDs if they are part of the same primary product (For reference only)
:: Separator = "_"
::===============
:: We couldn't find any keys (blocked/generic doesn't matter) for these Office 2010 products. If you have them, please share with us.
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_Retail________ExcelR_[HSExcelR]
14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR
14_fbf4ac36-31c8-4340-8666-79873129cf40_Retail________OutlookR
14_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR]
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR]
14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR]
:: These installers are not publicly available, so it doesn't matter if we don't have their keys.
14_19316117-30a8-4773-8fd9-7f7231f4e060_SubPrepid_____HomeBusinessSubR
14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_SubPrepid_____ProjectProSubR
14_e98ef0c0-71c4-42ce-8305-287d8721e26c_SubPrepid_____ProPlusSubR
14_14f5946a-debc-4716-babc-7e2c240fec08_Retail________MondoR
14_533b656a-4425-480b-8e30-1a2358898350_MAK___________MondoVL
:ohookdata
set f=
for %%# in (
:: Office 2010
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_7KTYC-XR43P-C3MRW-BJKFD-XB%f%YPG_Retail________AccessR
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_7XHPQ-BQMYG-YBP49-CY8B2-T8%f%CGQ_ByPass________AccessRuntimeR
14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_89RTQ-MT4GK-6CPTX-WWP7C-J9%f%KXR_MAK___________AccessVL
14_71dc86ff-f056-40d0-8ffb-9592705c9b76_39TRR-C2F37-9WYJ2-MJQXH-B9%f%38K_MAK___________ExcelVL
14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_RCGT3-FPQDV-H49CD-PPDBF-TH%f%47G_MAK___________GrooveVL
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_3YR9B-D9W79-BY66R-R8XYP-QY%f%YYY_Retail________HomeBusinessR_[HomeBusinessDemoR]
14_09e2d37e-474b-4121-8626-58ad9be5776f_3X43R-HHHXX-FRHRW-2M2WJ-8V%f%PHD_Retail________HomeStudentR_[HomeStudentDemoR]
14_ef1da464-01c8-43a6-91af-e4e5713744f9_XDGJY-KFHW9-JWX9X-YM4GW-GC%f%8WR_Retail________InfoPathR
14_85e22450-b741-430c-a172-a37962c938af_6GKT2-KMJPK-4RRBF-8VQKB-JB%f%6G6_MAK___________InfoPathVL
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_2TG3P-9DB76-4YT99-8RXGD-CW%f%XBP_Retail________OneNoteR_[HSOneNoteR]
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_CV64P-F4VRH-BJ33D-PH6MR-X6%f%9RY_MAK___________OneNoteVL
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_J8C9M-YXMH2-9CX44-2C3YG-V7%f%692_MAK___________OutlookVL
14_acb51361-c0db-4895-9497-1831c41f31a6_GMBWM-WVX26-7WHV4-DB43D-WV%f%DY2_Retail________PersonalR_[PersonalDemoR,PersonalPrepaidR]
14_38252940-718c-4aa6-81a4-135398e53851_HPBQP-RJHDR-Q3472-PT9Q6-PB%f%B72_MAK___________PowerPointVL
14_8b559c37-0117-413e-921b-b853aeb6e210_367X9-9HP9R-TKHY6-DH4QH-K9%f%PY7_Retail________ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR,OEM-SingleImage]
14_725714d7-d58f-4d12-9fa8-35873c6f7215_6JD4G-KRW3J-48MGV-DM6FC-T9%f%WKR_Retail________ProjectProR_[ProjectProMSDNR]
14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_3XDTH-MMGJ6-F9MKX-THP8D-G9%f%BP7_MAK___________ProjectProVL
14_688f6589-2bd9-424e-a152-b13f36aa6de1_2W96V-RTQ9R-2BPVT-PT8H9-MV%f%68T_Retail________ProjectStdR
14_11b39439-6b93-4642-9570-f2eb81be2238_4DTT4-D4MKX-23KFH-JKR6T-YK%f%G2J_MAK___________ProjectStdVL
14_71af7e84-93e6-4363-9b69-699e04e74071_2J9H6-H4D3G-PCXD2-96XVM-TR%f%R73_Retail________ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R]
14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_6CD6C-9R8PB-T2D9Y-8RKKX-W7%f%DFK_MAK___________ProPlusVL_[ProPlusAcadVL]
14_98677603-a668-4fa4-9980-3f1f05f78f69_CTRJP-P72VV-JBF8Y-4W6WW-HX%f%HVG_Retail________PublisherR
14_3d014759-b128-4466-9018-e80f6320d9d0_32YG9-3VX77-YXJVV-PRVFW-TT%f%8BV_MAK___________PublisherVL
14_8090771e-d41a-4482-929e-de87f1f47e46_7VKXH-9BWCG-RPTBB-JBRV3-GR%f%HYC_MAK___________SmallBusBasicsVL
14_b78df69e-0966-40b1-ae85-30a5134dedd0_H48K6-FB4Y6-P83GH-9J7XG-HD%f%KKX_ByPass________SPDR
14_b6d2565c-341d-4768-ad7d-addbe00bb5ce_W3BTX-H6BW7-Q6DFW-BXFFY-8R%f%VJP_Retail________StandardR_[StandardMSDNR][KeyisforMSDNR]
14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_2XTQP-GDR7C-GTXPC-6W6PV-4R%f%XGC_MAK___________StandardVL_[StandardAcadVL]
14_2745e581-565a-4670-ae90-6bf7c57ffe43_VXHHB-W7HBD-7M342-RJ7P8-CH%f%BD6_ByPass________StarterR
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_2RDPT-WPYQM-C2WXF-BTPDW-2J%f%2HM_Retail________VisioSIR_Prem[Pro,Std]
14_36756cb8-8e69-4d11-9522-68899507cd6a_7PKFT-X2MKQ-GT6X2-8CB2W-CH%f%C9K_MAK___________VisioSIVL_Prem[Pro,Std]
14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_6J3XK-DFKGK-X373V-QJHYM-V3%f%FC2_MAK___________WordVL
:: 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
@@ -2190,6 +2513,7 @@ for %%# in (
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_dabaa1f2-109b-496d-bf49-1536cc862900_3HYJN-9KG99-F8VG9-V3DT8-JF%f%MHV_Subscription__O365AppsBasicRetail
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_a96f8dae-da54-4fad-bdc6-108da592707a_3NMDC-G7C3W-68RGP-CB4MH-4C%f%XCH_SubTest1______O365HomePremRetail
@@ -2373,6 +2697,49 @@ exit /b
:msiofficedata
for %%# in (
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR
14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR]
14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL
14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR
14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR]
14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR
14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR]
14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR
14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL
14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR
14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL
14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR]
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL
14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL
14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR]
14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR]
14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL
14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR]
14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR]
14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_011F_ProjectProSubR
14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_003B_ProjectProVL
14_688f6589-2bd9-424e-a152-b13f36aa6de1_003A_ProjectStdR
14_11b39439-6b93-4642-9570-f2eb81be2238_003A_ProjectStdVL
14_71af7e84-93e6-4363-9b69-699e04e74071_0011_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R]
14_e98ef0c0-71c4-42ce-8305-287d8721e26c_011D_ProPlusSubR
14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_0011_ProPlusVL_[ProPlusAcadVL]
14_98677603-a668-4fa4-9980-3f1f05f78f69_0019_PublisherR
14_3d014759-b128-4466-9018-e80f6320d9d0_0019_PublisherVL
14_dbe3aee0-5183-4ff7-8142-66050173cb01_008B_SmallBusBasicsR_[SmallBusBasicsMSDNR]
14_8090771e-d41a-4482-929e-de87f1f47e46_008B_SmallBusBasicsVL
14_b78df69e-0966-40b1-ae85-30a5134dedd0_0017_SPDR
14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_0012_StandardR
14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_0012_StandardVL_[StandardAcadVL]
14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception
14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR]
14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL
:: Office 2013
15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail
15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail
@@ -2489,6 +2856,7 @@ if "%oVer%"=="%%A" (
reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && (
reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && (
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
if /i 003D==%%C set SingleImage=1
)
)
)
@@ -2505,7 +2873,7 @@ exit /b
:oh_extractdll
set b=
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1]);" %nul2% | find /i "Error found" %nul1% && set hasherror=1
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1])" %nul2% | find /i "Error found" %nul1% && set hasherror=1
exit /b
:hexedit:
@@ -2544,7 +2912,7 @@ $Writer.Write($unixTimestamp)
$Writer.Flush()
# Write the current state of the MemoryStream to a temporary file
$tempFilePath = [System.IO.Path]::Combine($env:windir, "Temp", [System.IO.Path]::GetRandomFileName())
$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())"
[System.IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
# Update hash using the temporary file

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -125,6 +125,8 @@ set "nul="
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -214,15 +216,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
goto dk_done
)
if not exist %ps% (
if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
%nceline%
if not exist %ps% (
echo PowerShell is not installed in your system.
if %winbuild% LSS 7600 (
echo Install PowerShell using the following URL.
)
echo Install PowerShell 2.0 using the following URL.
echo:
echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
)
if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
goto dk_done
)
@@ -278,12 +280,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -313,7 +317,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -395,7 +405,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
@@ -489,11 +499,13 @@ if not exist %SysPath%\%_slexe% (
%eline%
echo [%SysPath%\%_slexe%] file is missing, aborting...
echo:
if not defined results (
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
call :dk_color %Blue% "After that, restart system and try activation again."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
)
goto dk_done
)
@@ -677,6 +689,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [
)
if defined key (
set generickey=1
call :dk_inskey "[%key%]"
)
@@ -686,7 +699,7 @@ call :dk_inskey "[%key%]"
if not %_actoff%==1 goto :ks_activate
call :ks_setspp
call :oh_setspp
:: Check ohook install
@@ -731,7 +744,7 @@ set ohub=1
:: Check supported office versions
call :ks_getpath
call :oh_getpath
set o16uwp=
set o16uwp_path=
@@ -771,7 +784,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]"
if defined ohub (
echo:
echo You have only Office dashboard app installed, you need to install full Office version.
echo You only have the Office Dashboard app installed. You need to install the full version of Office.
)
call :dk_color %Blue% "Download and install Office from below URL and try again."
set fixes=%fixes% %mas%genuine-installation-media
@@ -910,9 +923,9 @@ call :ks_process
:ks_startmsi
if defined o14msi call :ks_setspp 14
if defined o14msi call :oh_setspp 14
if defined o14msi call :ks_processmsi 14 %o14msi_reg%
call :ks_setspp
call :oh_setspp
if defined o15msi call :ks_processmsi 15 %o15msi_reg%
if defined o16msi call :ks_processmsi 16 %o16msi_reg%
@@ -928,7 +941,7 @@ call :oh_licrefresh
:ks_activate
:: Opt out of sending KMSclient activation data to Microsoft
:: https://learn.microsoft.com/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform
:: https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform
if %winbuild% GEQ 9600 (
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v NoGenTicket /t REG_DWORD /d 1 /f %nul%
@@ -996,7 +1009,7 @@ echo Cleared %KS% Server from the registry.
)
)
:: https://learn.microsoft.com/azure/virtual-desktop/windows-10-multisession-faq
:: https://learn.microsoft.com/en-us/azure/virtual-desktop/windows-10-multisession-faq
if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# (
call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
@@ -1056,7 +1069,7 @@ exit /b
::========================================================================================================================================
:ks_getpath
:oh_getpath
set o16c2r=
set o15c2r=
@@ -1072,12 +1085,12 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %
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 o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun)
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 o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun)
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 o16msi=1&set o16msi_reg=%_86%\16.0)
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 o16msi=1&set o16msi_reg=%_68%\16.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0)
exit /b
@@ -1143,16 +1156,19 @@ exit /b
::========================================================================================================================================
:ks_setspp
:oh_setspp
set isOspp=
if %winbuild% GEQ 9200 (
set spp=SoftwareLicensingProduct
set sps=SoftwareLicensingService
) else (
set isOspp=1
set spp=OfficeSoftwareProtectionProduct
set sps=OfficeSoftwareProtectionService
)
if "%1"=="14" (
set isOspp=1
set spp=OfficeSoftwareProtectionProduct
set sps=OfficeSoftwareProtectionService
)
@@ -1206,12 +1222,17 @@ call :ksdata getinfo !_prod!
if defined _altoffid (
set _License=!_altoffid!
echo Converting Retail To Volume [!_prod! To !_altoffid!]
echo %%# | find /i "O365" %nul% && (
if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.")
if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.")
)
set _prod=!_altoffid!
call :ks_osppready
)
if not "!key!"=="" (
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
set generickey=1
call :dk_inskey "[!key!] [!_prod!]"
) else (
if not defined _oMSI (
@@ -1220,7 +1241,7 @@ call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !
call :dk_color %Blue% "Make sure you are using Latest MAS script."
) else (
call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]"
call :dk_color %Blue% "Uninstall this and Install C2R or MSI VL version of Office."
call :dk_color %Blue% "Use Ohook option to activate it. To activate with %KS%, you need to install Volume version of Office."
)
set fixes=%fixes% %mas%genuine-installation-media
call :dk_color %_Yellow% "%mas%genuine-installation-media"
@@ -1254,10 +1275,6 @@ 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
set "_common=%CommonProgramFiles%"
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
set "_common2=%CommonProgramFiles(x86)%"
call :msiofficedata %2
echo:
@@ -1327,7 +1344,7 @@ exit /b
:oh_clearblock
:: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state
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))
@@ -1423,12 +1440,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
)
:: Clear device-based-licensing
:: https://learn.microsoft.com/deployoffice/device-based-licensing
:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing
for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
:: Remove OEM registry key
:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
for %%# in (15 16) do (
reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul%
@@ -1686,6 +1703,7 @@ set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
)
if %winbuild% LSS 9200 set _wmic=1
setlocal EnableDelayedExpansion
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
@@ -2632,11 +2650,12 @@ set keyerror=%errorlevel%
cmd /c exit /b %keyerror%
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ")
if %keyerror% EQU 0 (
if %sps%==SoftwareLicensingService call :dk_refresh
echo Installing Generic Product Key %~1 [Successful]
echo %keyecho% %~1 [Successful]
) else (
call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%"
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
if not defined error (
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
call :dk_color %Blue% "%_fixmsg%"
@@ -2645,6 +2664,7 @@ set showfix=1
set error=1
)
set generickey=
exit /b
:: Get Windows installed key channel
@@ -2669,9 +2689,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
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%
echo:!allapps!> "!_ttemp!\chklen"
for %%A in ("!_ttemp!\chklen") do (set len=%%~zA)
del "!_ttemp!\chklen" %nul%
if !len! GTR 6000 (
%eline%
@@ -2739,6 +2759,7 @@ function ReinstallLicenses() {
:dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@@ -2766,7 +2787,7 @@ exit /b
:dk_product
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%')
set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, ''
set winos=
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
@@ -2776,10 +2797,6 @@ if %winbuild% GEQ 22000 (
set winos=!winos:Windows 10=Windows 11!
)
)
if %winbuild% LSS 7600 (
set "winos=!winos:VistaT=Vista!"
set "winos=!winos:Serverr=Server!"
)
if not defined winsub exit /b
@@ -2881,7 +2898,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
if defined results (call :dk_color %Red% "%results%"&set showfix=1)
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
@@ -3020,7 +3037,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
)
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
:: https://learn.microsoft.com/en-us/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)
@@ -3091,13 +3108,16 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
)
)
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
@@ -3288,7 +3308,7 @@ set "permerror=Error Found In SPP Registries"
)
)
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
@@ -3413,7 +3433,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (
@@ -3435,47 +3456,30 @@ exit /b
:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only)
:: Separator = "_"
:: EditionID Notes:
:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing.
:: In Office 2010, the situation is a bit more complicated.
:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types.
:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID.
:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID.
:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage.
:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three.
:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case.
:msiofficedata
for %%# in (
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR
14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR]
14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL
14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR
14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR]
14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR
14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR]
14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR
14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR
14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR
14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR
14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR
14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL
14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR
14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL
14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR]
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL
14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL
14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR]
14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR
14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR]
14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL
14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR]
14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR]
@@ -3496,7 +3500,7 @@ for %%# in (
14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception
14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR]
14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL
:: Office 2013
15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail
@@ -3614,6 +3618,7 @@ if "%oVer%"=="%%A" (
reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && (
reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && (
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
if /i 003D==%%C set SingleImage=1
)
)
)
@@ -3819,7 +3824,7 @@ d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3_6Q7VD-NX8JD-WJ2VH-88V73-4G%f%BJ7__15_WordVo
67c0fc0c-deba-401b-bf8b-9c8ad8395804_GNH9Y-D2J4T-FJHGG-QRVH7-QP%f%FDW__16_AccessVolume_-AccessRetail-
c3e65d36-141f-4d2f-a303-a842ee756a29_9C2PK-NWTVB-JMPW8-BFT28-7F%f%TBF__16_ExcelVolume_-ExcelRetail-
e914ea6e-a5fa-4439-a394-a9bb3293ca09_DMTCJ-KNRKX-26982-JYCKT-P7%f%KB6__16_MondoRetail
9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail-
9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365AppsBasicRetail-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail-
436366de-5579-4f24-96db-3893e4400030_XYNTG-R96FY-369HX-YFPHY-F9%f%CPM__16_OneNoteFreeRetail_[Bypass]
d8cace59-33d2-4ac7-9b1b-9b72339c51c8_DR92N-9HTF2-97XKM-XW2WJ-XW%f%3J6__16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail-
ec9d9265-9d1e-4ed0-838a-cdc20f2551a1_R69KK-NTPKF-7M3Q4-QYBHW-6M%f%T9B__16_OutlookVolume_-OutlookRetail-

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -60,6 +60,8 @@ exit /b
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -192,12 +194,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -227,7 +231,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -309,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
@@ -323,15 +333,6 @@ echo:
echo Initializing...
echo:
if not exist %SysPath%\sppsvc.exe (
%eline%
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
::========================================================================================================================================
set spp=SoftwareLicensingProduct
@@ -365,8 +366,7 @@ if %osedition%==0 (
%eline%
echo Failed to detect OS Edition. Aborting...
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
goto dk_done
)
@@ -415,6 +415,7 @@ _updch
_lang
_clversion
_version
_AudienceData
_oIds
_c2rXml
_c2rExe
@@ -802,8 +803,40 @@ set errorcode=%errorlevel%
timeout /t 10 %nul%
echo:
set suggestchannel=
if %errorcode% EQU 0 (
call :dk_color %Gray% "Now run the Office activation option from the main menu."
if %change%==1 (
echo %targetedition% | find /i "2019Volume" %nul% && (
if not defined ltsc19 set suggestchannel=Production::LTSC
if /i not %_AudienceData%==Production::LTSC set suggestchannel=Production::LTSC
if /i not %_updch%==F2E724C1-748F-4B47-8FB8-8E0D210E9208 set suggestchannel=Production::LTSC
)
echo %targetedition% | find /i "2021Volume" %nul% && (
if not defined ltsc21 set suggestchannel=Production::LTSC2021
if /i not %_AudienceData%==Production::LTSC2021 set suggestchannel=Production::LTSC2021
if /i not %_updch%==5030841D-C919-4594-8D2D-84AE4F96E58E set suggestchannel=Production::LTSC2021
)
echo %targetedition% | find /i "2024Volume" %nul% && (
if not defined ltsc24 set suggestchannel=Production::LTSC2024
if /i not %_AudienceData%==Production::LTSC2024 set suggestchannel=Production::LTSC2024
if /i not %_updch%==7983BAC0-E531-40CF-BE00-FD24FE66619C set suggestchannel=Production::LTSC2024
)
echo %targetedition% | findstr /R "20.*Volume" %nul% || (
if defined ltscfound set suggestchannel=Production::CC
echo %_AudienceData% | find /i "LTSC" %nul% && set suggestchannel=Production::CC
)
if defined suggestchannel (
call :dk_color %Gray% "Mismatch found in update channel and installed product."
call :dk_color %Blue% "It is recommended to change the update channel to [!suggestchannel!] from the previous menu."
)
echo:
)
call :dk_color %Gray% "To activate Office, run the activation option from the main menu."
) else (
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -980,6 +1013,12 @@ echo Installed Office editions: %_oIds%
echo Unsupported Office edition is installed on your Windows build version %winbuild%.
goto :oe_goback
)
if defined ltscfound (
%eline%
echo Installed Office update channel: %ltsc19%%ltsc21%%ltsc24%
echo Unsupported Office update channel is installed on your Windows build version %winbuild%.
goto :oe_goback
)
)
::===============
@@ -988,49 +1027,52 @@ set inpt=
set counter=0
set verified=0
set targetFFN=
set bypassFFN=
set targetchannel=
%line%
echo:
call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%"
call :dk_color %Gray% "Unsupported update channels are excluded from this list."
call :dk_color %Gray% "Installed Office editions: %_oIds%"
%line%
echo:
for %%# in (
"5440FD1F-7ECB-4221-8110-145EFAA6372F_Insider Fast [Beta] - Insiders::DevMain"
"64256AFE-F5D9-4F86-8936-8840A6A4F5BE_Monthly Preview - Insiders::CC"
"492350F6-3A01-4F97-B9C0-C7C6DDF67D60_Monthly [Current] - Production::CC"
"55336B82-A18D-4DD6-B5F6-9E5095C314A6_Monthly Enterprise - Production::MEC"
"B8F9B850-328D-4355-9145-C59439A0C4CF_Semi Annual Preview - Insiders::FRDC"
"7FFBC6BF-BC32-4F92-8982-F9DD17FD3114_Semi Annual - Production::DC"
"EA4A4090-DE26-49D7-93C1-91BFF9E53FC3_DevMain Channel - Dogfood::DevMain"
"B61285DD-D9F7-41F2-9757-8F61CBA4E9C8_Microsoft Elite - Microsoft::DevMain"
"F2E724C1-748F-4B47-8FB8-8E0D210E9208_Perpetual2019 VL - Production::LTSC"
"1D2D2EA6-1680-4C56-AC58-A441C8C24FF9_Microsoft2019 VL - Microsoft::LTSC"
"5030841D-C919-4594-8D2D-84AE4F96E58E_Perpetual2021 VL - Production::LTSC2021"
"86752282-5841-4120-AC80-DB03AE6B5FDB_Microsoft2021 VL - Microsoft::LTSC2021"
"7983BAC0-E531-40CF-BE00-FD24FE66619C_Perpetual2024 VL - Production::LTSC2024"
"C02D8FE6-5242-4DA8-972F-82EE55E00671_Microsoft2024 VL - Microsoft::LTSC2024"
"5440fd1f-7ecb-4221-8110-145efaa6372f_Insider Fast [Beta] - Insiders::DevMain -"
"64256afe-f5d9-4f86-8936-8840a6a4f5be_Monthly Preview - Insiders::CC -"
"492350f6-3a01-4f97-b9c0-c7c6ddf67d60_Monthly [Current] - Production::CC -"
"55336b82-a18d-4dd6-b5f6-9e5095c314a6_Monthly Enterprise - Production::MEC -"
"b8f9b850-328d-4355-9145-c59439a0c4cf_Semi Annual Preview - Insiders::FRDC -"
"7ffbc6bf-bc32-4f92-8982-f9dd17fd3114_Semi Annual - Production::DC -"
"ea4a4090-de26-49d7-93c1-91bff9e53fc3_DevMain Channel - Dogfood::DevMain -"
"b61285dd-d9f7-41f2-9757-8f61cba4e9c8_Microsoft Elite - Microsoft::DevMain -"
"f2e724c1-748f-4b47-8fb8-8e0d210e9208_Perpetual2019 VL - Production::LTSC -"
"1d2d2ea6-1680-4c56-ac58-a441c8c24ff9_Microsoft2019 VL - Microsoft::LTSC -"
"5030841d-c919-4594-8d2d-84ae4f96e58e_Perpetual2021 VL - Production::LTSC2021 -"
"86752282-5841-4120-ac80-db03ae6b5fdb_Microsoft2021 VL - Microsoft::LTSC2021 -"
"7983bac0-e531-40cf-be00-fd24fe66619c_Perpetual2024 VL - Production::LTSC2024 -"
"c02d8fe6-5242-4da8-972f-82ee55e00671_Microsoft2024 VL - Microsoft::LTSC2024 -"
) do (
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
set bypass=
set supported=
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
if %winbuild% GEQ 10240 (
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported=
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported=
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported=
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported=
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set bypass=1
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set bypass=1
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set bypass=1
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set bypass=1
)
if defined supported (
set /a counter+=1
if !counter! LSS 10 (
echo [!counter!] %%B
if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
) else (
echo [!counter!] %%B
if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
)
set targetFFN!counter!=%%A
set targetchannel!counter!=%%B
if defined bypass set bypassFFN=!bypassFFN!%%A
)
)
)
@@ -1044,7 +1086,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En
set /p inpt=
if "%inpt%"=="" goto :oe_changeupdchnl
if "%inpt%"=="0" goto :oemenu
if /i "%inpt%"=="R" start https://learn.microsoft.com/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl
if /i "%inpt%"=="R" start https://learn.microsoft.com/en-us/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
set targetFFN=!targetFFN%inpt%!
set targetchannel=!targetchannel%inpt%!
@@ -1061,15 +1103,133 @@ set build=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a)
echo "%build%" | find /i "16." %nul% || set build=
echo:
for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A)
echo Target build number: %build%
echo: %bypassFFN% | find /i "%targetFFN%" %nul% && goto :oe_changeunoff
call :oe_cleanupreg
if not defined build (
if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN."
set "updcommand="%_c2rCexe%" /update user"
) else (
set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%"
)
echo Running the below command to trigger updates...
echo:
echo %updcommand%
%updcommand%
echo:
echo Check this webpage for help - %mas%troubleshoot
goto :oe_goback
::=======================
:: Unofficial method to change channel
:oe_changeunoff
set abortchange=
echo %targetchannel% | find /i "2019 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2019Volume" %nul% || set abortchange=1))
echo %targetchannel% | find /i "2021 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2021Volume" %nul% || set abortchange=1))
echo %targetchannel% | find /i "2024 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2024Volume" %nul% || set abortchange=1))
if defined abortchange (
%eline%
echo Mismatch found in installed Office products and target update channel. Aborting...
echo Non-perpetual Office products are not suppported with Perpetual VL update channels.
goto :oe_goback
)
if not defined build (
%eline%
call :dk_color %Red% "Failed to detect build number for the target FFN."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto :oe_goback
)
set buildchk=0
for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a"
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE"
if %clverchk% LSS %buildchk% (
echo:
call :dk_color %Blue% "Do not terminate the operation before it completes..."
echo:
echo Updating Office C2R client with the command below, please wait...
echo:
echo %c2rclientupdate%
%c2rclientupdate%
for /l %%i in (1,1,30) do (if !clverchk! LSS %buildchk% (call :ch_getinfo&timeout /t 10 %nul%))
)
if %clverchk% LSS %buildchk% (
echo:
call :dk_color %Red% "Failed to update Office C2R client. Aborting..."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto :oe_goback
)
call :oe_cleanupreg
echo Running the below command to change update channel, please wait...
echo:
echo %c2rcommand%
%c2rcommand%
set errorcode=%errorlevel%
timeout /t 10 %nul%
echo:
if %errorcode% EQU 0 (
call :dk_color %Gray% "Now run the Office activation option from the main menu."
) else (
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
)
::========================================================================================================================================
:oe_goback
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!==2 goto :oemenu
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (
call :dk_color %_Yellow% "Press [0] key to go back..."
choice /c 0 /n
) else (
call :dk_color %_Yellow% "Press any key to go back..."
pause %nul1%
)
goto :oemenu
::========================================================================================================================================
:oe_cleanupreg
:: Cleanup Office update related registries, thanks to @abbodi1406
:: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813
:: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels
echo:
for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A)
echo:
echo Cleaning Office update registry keys...
echo Adding new update channel to registry keys...
echo:
%nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
%nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
@@ -1086,42 +1246,7 @@ echo Adding new update channel to registry keys...
%nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32
%nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f
if not defined build (
if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN."
set "updcommand="%_c2rCexe%" /update user"
) else (
set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%"
)
echo Running the below command to trigger updates...
echo:
echo %updcommand%
%updcommand%
echo:
echo Check this webpage for help - %mas%troubleshoot
goto :oe_goback
::========================================================================================================================================
:oe_goback
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 %%#))
)
if defined terminal (
call :dk_color %_Yellow% "Press [0] key to go back..."
choice /c 0 /n
) else (
call :dk_color %_Yellow% "Press any key to go back..."
pause %nul1%
)
goto :oemenu
exit /b
::========================================================================================================================================
@@ -1144,6 +1269,7 @@ set _oRoot=
set _oArch=
set _updch=
set _oIds=
set _firstoId=
set _lang=
set _cfolder=
set _version=
@@ -1174,9 +1300,13 @@ for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseI
if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a")
)
set _oIds=%_oIds:.16=%
for /f "tokens=1" %%A in ("%_oIds%") do set _firstoId=%%A
for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\Configuration /v %_firstoId%.ExcludedApps" %nul6%') do (set "_firstoIdExcludelist=%%b")
set verchk=0
set clverchk=0
for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a"
for /f "tokens=3 delims=." %%a in ("%_clversion%") do set "clverchk=%%a"
if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml"
@@ -1192,16 +1322,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
)
set "audidata4=%_AudienceData:~-4%"
:: Check LTSC version files
if /i "%audidata4%"=="LTSC" set ltsc19=LTSC
echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021
echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
if /i "%audidata4%"=="2024" set ltsc24=LTSC2024
:: LTSC 2024 build is not fixed yet
for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\ProductReleaseIDs\%_actconfig%" /s %nul6%') do (
echo "%%b" %nul2% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
echo "%%b" %nul2% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
echo "%%b" %nul2% | findstr "16.0.17932" %nul% && set ltsc24=LTSC2024
)
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
@@ -1408,6 +1535,7 @@ exit /b
:dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@@ -1474,7 +1602,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -65,6 +65,8 @@ exit /b
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -197,12 +199,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -232,7 +236,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -314,7 +324,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
@@ -390,8 +400,7 @@ if not defined allapps (
%eline%
echo Failed to find activation IDs. Aborting...
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
goto dk_done
)
@@ -413,8 +422,7 @@ if not defined osedition (
%eline%
echo Failed to detect OS edition, aborting...
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
goto dk_done
)
@@ -795,7 +803,7 @@ exit /b
:: https://stackoverflow.com/a/46268232
set "ddf="%SystemRoot%\Temp\ddf""
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
%nul% del /q /f %ddf%
echo/.New Cabinet>%ddf%
echo/.set Cabinet=ON>>%ddf%
@@ -910,6 +918,7 @@ exit /b
:dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@@ -1056,7 +1065,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (

View File

@@ -201,12 +201,14 @@ function BoolToWStr($bVal) {
}
function InitializePInvoke($LaDll, $bOffice) {
$Marshal = [System.Runtime.InteropServices.Marshal]
$Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random), $False)
$SLApp = $NT7 -Or $bOffice -Or ($LaDll -EQ 'sppc.dll' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501)
$LaName = [IO.Path]::GetFileNameWithoutExtension($LaDll)
$SLApp = $NT7 -Or $bOffice -Or ($LaName -EQ 'sppc' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501)
$Win32 = $null
$Class = $Module.DefineType((Get-Random), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0)
$Marshal = [System.Runtime.InteropServices.Marshal]
$Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly(($LaName+"_Assembly"), 'Run').DefineDynamicModule(($LaName+"_Module"), $False)
$Class = $Module.DefineType(($LaName+"_Methods"), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0)
$Class.DefinePInvokeMethod('SLClose', $LaDll, 22, 1, [Int32], @([IntPtr]), 1, 3).SetImplementationFlags(128)
$Class.DefinePInvokeMethod('SLOpen', $LaDll, 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128)
$Class.DefinePInvokeMethod('SLGenerateOfflineInstallationId', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128)
@@ -255,10 +257,51 @@ function SlGetInfoIID($SkuId)
{
return $null
}
else
{
return $Marshal::PtrToStringUni($bData)
}
}
$rData = $Marshal::PtrToStringUni($bData)
$Marshal::FreeHGlobal($bData)
return $rData
function SlReturnData($hrRet, $tData, $cData, $bData) {
if ($hrRet -NE 0 -Or $cData -EQ 0)
{
return $null
}
if ($tData -EQ 1)
{
return $Marshal::PtrToStringUni($bData)
}
elseif ($tData -EQ 4)
{
return $Marshal::ReadInt32($bData)
}
elseif ($tData -EQ 3 -And $cData -EQ 8)
{
return $Marshal::ReadInt64($bData)
}
else
{
return $null
}
}
function SlGetInfoPKey($PkeyId, $Value)
{
$tData = 0
$cData = 0
$bData = 0
$hrRet = $Win32::SLGetPKeyInformation(
$hSLC,
[ref][Guid]$PkeyId,
$Value,
[ref]$tData,
[ref]$cData,
[ref]$bData
)
return SlReturnData $hrRet $tData $cData $bData
}
function SlGetInfoSku($SkuId, $Value)
@@ -267,7 +310,7 @@ function SlGetInfoSku($SkuId, $Value)
$cData = 0
$bData = 0
$ret = $Win32::SLGetProductSkuInformation(
$hrRet = $Win32::SLGetProductSkuInformation(
$hSLC,
[ref][Guid]$SkuId,
$Value,
@@ -276,70 +319,7 @@ function SlGetInfoSku($SkuId, $Value)
[ref]$bData
)
if ($ret -Or !$cData)
{
return $null
}
if ($tData -EQ 1)
{
$rData = $Marshal::PtrToStringUni($bData)
}
elseif ($tData -EQ 4)
{
$rData = $Marshal::ReadInt32($bData)
}
elseif ($tData -EQ 3 -And $cData -EQ 8)
{
$rData = $Marshal::ReadInt64($bData)
}
else
{
$rData = $null
}
$Marshal::FreeHGlobal($bData)
return $rData
}
function SlGetInfoService($Value)
{
$tData = 0
$cData = 0
$bData = 0
$ret = $Win32::SLGetServiceInformation(
$hSLC,
$Value,
[ref]$tData,
[ref]$cData,
[ref]$bData
)
if ($ret -Or !$cData)
{
return $null
}
if ($tData -EQ 1)
{
$rData = $Marshal::PtrToStringUni($bData)
}
elseif ($tData -EQ 4)
{
$rData = $Marshal::ReadInt32($bData)
}
elseif ($tData -EQ 3 -And $cData -EQ 8)
{
$rData = $Marshal::ReadInt64($bData)
}
else
{
$rData = $null
}
$Marshal::FreeHGlobal($bData)
return $rData
return SlReturnData $hrRet $tData $cData $bData
}
function SlGetInfoApp($AppId, $Value)
@@ -348,7 +328,7 @@ function SlGetInfoApp($AppId, $Value)
$cData = 0
$bData = 0
$ret = $Win32::SLGetApplicationInformation(
$hrRet = $Win32::SLGetApplicationInformation(
$hSLC,
[ref][Guid]$AppId,
$Value,
@@ -357,80 +337,49 @@ function SlGetInfoApp($AppId, $Value)
[ref]$bData
)
if ($ret -Or !$cData)
{
return $null
}
return SlReturnData $hrRet $tData $cData $bData
}
if ($tData -EQ 1)
{
$rData = $Marshal::PtrToStringUni($bData)
}
elseif ($tData -EQ 4)
{
$rData = $Marshal::ReadInt32($bData)
}
elseif ($tData -EQ 3 -And $cData -EQ 8)
{
$rData = $Marshal::ReadInt64($bData)
}
else
{
$rData = $null
}
function SlGetInfoService($Value)
{
$tData = 0
$cData = 0
$bData = 0
$Marshal::FreeHGlobal($bData)
return $rData
$hrRet = $Win32::SLGetServiceInformation(
$hSLC,
$Value,
[ref]$tData,
[ref]$cData,
[ref]$bData
)
return SlReturnData $hrRet $tData $cData $bData
}
function SlGetInfoSvcApp($strApp, $Value)
{
if ($SLApp)
{
$rData = SlGetInfoApp $strApp $Value
return SlGetInfoApp $strApp $Value
}
else
{
$rData = SlGetInfoService $Value
return SlGetInfoService $Value
}
return $rData
}
function SlGetInfoPKey($PkeyId, $Value)
{
$cData = 0
$bData = 0
$ret = $Win32::SLGetPKeyInformation(
$hSLC,
[ref][Guid]$PKeyId,
$Value,
[ref]$null,
[ref]$cData,
[ref]$bData
)
if ($ret -Or !$cData)
{
return $null
}
$rData = $Marshal::PtrToStringUni($bData)
$Marshal::FreeHGlobal($bData)
return $rData
}
function SlGetInfoLicensing($AppId, $SkuId)
{
$LicenseStatus = 0
$GracePeriodRemaining = 0
$dwStatus = 0
$dwGrace = 0
$hrReason = 0
$EvaluationEndDate = 0
$qwValidity = 0
$cStatus = 0
$pStatus = 0
$ret = $Win32::SLGetLicensingStatusInformation(
$hrRet = $Win32::SLGetLicensingStatusInformation(
$hSLC,
[ref][Guid]$AppId,
[ref][Guid]$SkuId,
@@ -439,80 +388,46 @@ function SlGetInfoLicensing($AppId, $SkuId)
[ref]$pStatus
)
if ($ret -Or !$cStatus)
if ($hrRet -NE 0 -Or $cStatus -EQ 0)
{
return
}
[IntPtr]$ppStatus = [Int64]$pStatus + [Int64]40 * ($cStatus - 1)
$eStatus = $Marshal::ReadInt32($ppStatus, 16)
$GracePeriodRemaining = $Marshal::ReadInt32($ppStatus, 20)
$dwStatus = $Marshal::ReadInt32($ppStatus, 16)
$dwGrace = $Marshal::ReadInt32($ppStatus, 20)
$hrReason = $Marshal::ReadInt32($ppStatus, 28)
$EvaluationEndDate = $Marshal::ReadInt64($ppStatus, 32)
$qwValidity = $Marshal::ReadInt64($ppStatus, 32)
if ($eStatus -EQ 3)
if ($dwStatus -EQ 3)
{
$eStatus = 5
$dwStatus = 5
}
if ($eStatus -EQ 2)
if ($dwStatus -EQ 2)
{
if ($hrReason -EQ 0x4004F00D)
{
$eStatus = 3
$dwStatus = 3
}
elseif ($hrReason -EQ 0x4004F065)
{
$eStatus = 4
$dwStatus = 4
}
elseif ($hrReason -EQ 0x4004FC06)
{
$eStatus = 6
$dwStatus = 6
}
}
$LicenseStatus = $eStatus
$Marshal::FreeHGlobal($pStatus)
return
}
function SlCheckInfo($SkuId, $Value)
{
$cData = 0
$bData = 0
$ret = $Win32::SLGetProductSkuInformation(
$hSLC,
[ref][Guid]$SkuId,
$Value,
[ref]$null,
[ref]$cData,
[ref]$bData
)
if ($ret -Or !$cData)
{
return $false
}
if ($Value -EQ "pkeyId")
{
$rData = $Marshal::PtrToStringUni($bData)
}
else
{
$rData = $true
}
$Marshal::FreeHGlobal($bData)
return $rData
}
function SlGetInfoSLID($AppId)
{
$cReturnIds = 0
$pReturnIds = 0
$ret = $Win32::SLGetSLIDList(
$hrRet = $Win32::SLGetSLIDList(
$hSLC,
0,
[ref][Guid]$AppId,
@@ -521,7 +436,7 @@ function SlGetInfoSLID($AppId)
[ref]$pReturnIds
)
if ($ret -Or !$cReturnIds)
if ($hrRet -NE 0 -Or $cReturnIds -EQ 0)
{
return
}
@@ -536,17 +451,16 @@ function SlGetInfoSLID($AppId)
$bytes = New-Object byte[] 16
$Marshal::Copy([Int64]$pReturnIds + [Int64]16 * $i, $bytes, 0, 16)
$actid = ([Guid]$bytes).Guid
$gPPK = SlCheckInfo $actid "pkeyId"
$gAdd = SlCheckInfo $actid "DependsOn"
$gPPK = SlGetInfoSku $actid "pkeyId"
$gAdd = SlGetInfoSku $actid "DependsOn"
if ($All.IsPresent) {
if (!$gPPK -And $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} }
if (!$gPPK -And !$gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} }
if ($null -EQ $gPPK -And $null -NE $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} }
if ($null -EQ $gPPK -And $null -EQ $gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} }
}
if ($gPPK -And $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} }
if ($gPPK -And !$gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} }
if ($null -NE $gPPK -And $null -NE $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} }
if ($null -NE $gPPK -And $null -EQ $gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} }
}
$Marshal::FreeHGlobal($pReturnIds)
return ($a1List + $a2List + $a3List + $a4List)
}
@@ -603,7 +517,7 @@ function DetectSubscription {
function DetectAdbaClient
{
$propADBA | foreach { set $_ (SlGetInfoSku $ID $_) }
$propADBA | foreach { set $_ (SlGetInfoSku $licID $_) }
CONOUT "`nAD Activation client information:"
CONOUT " Object Name: $ADActivationObjectName"
CONOUT " Domain Name: $ADActivationObjectDN"
@@ -613,7 +527,7 @@ function DetectAdbaClient
function DetectAvmClient
{
$propAVMA | foreach { set $_ (SlGetInfoSku $ID $_) }
$propAVMA | foreach { set $_ (SlGetInfoSku $licID $_) }
CONOUT "`nAutomatic VM Activation client information:"
if (-Not [String]::IsNullOrEmpty($InheritedActivationId)) {
CONOUT " Guest IAID: $InheritedActivationId"
@@ -644,7 +558,6 @@ function DetectKmsHost
if (-Not $IsKeyManagementService) {
return
}
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
if ($Vista -Or $NT5) {
$regk = $SLKeyPath
@@ -697,9 +610,9 @@ function DetectKmsHost
function DetectKmsClient
{
if ($strSLP -EQ $wslp -And $NT8)
if ($win8)
{
$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $ID) "VLActivationType"
$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $licID) "VLActivationType"
if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"}
if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"}
if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0}
@@ -713,7 +626,7 @@ function DetectKmsClient
}
if ($NT7 -Or $strSLP -EQ $oslp) {
$propKMSClient | foreach { set $_ (SlGetInfoSku $ID $_) }
$propKMSClient | foreach { set $_ (SlGetInfoSku $licID $_) }
if ($strSLP -EQ $oslp) {$regk = $OPKeyPath} else {$regk = $SPKeyPath}
$KMSCaching = strGetRegistry $regk "DisableKeyManagementServiceHostCaching"
if (-Not $KMSCaching) {$KMSCaching = "TRUE"} else {$KMSCaching = BoolToWStr (!$KMSCaching)}
@@ -771,58 +684,90 @@ function DetectKmsClient
function GetResult($strSLP, $strApp, $entry)
{
$ID = $entry.id
$propPrd | foreach { set $_ (SlGetInfoSku $ID $_) }
. SlGetInfoLicensing $strApp $ID
$licID = $entry.id
$propPrd | foreach { set $_ (SlGetInfoSku $licID $_) }
. SlGetInfoLicensing $strApp $licID
$LicenseStatus = $dwStatus
$LicReason = $hrReason
$EvaluationEndDate = $qwValidity
$gprMnt = $dwGrace
$pkid = $entry.pk
$isPPK = $null -NE $pkid
$add_on = $Name.IndexOf("add-on for", 5)
if ($add_on -NE -1) {
$Name = $Name.Substring(0, $add_on + 7)
}
$licPHN = "empty"
if ($Dlv -Or $All.IsPresent) {
$licPHN = SlGetInfoSku $licID "msft:sl/EUL/PHONE/PUBLIC"
}
if ($LicenseStatus -EQ 0 -And !$isPPK) {
& $isAll
CONOUT "Name: $Name"
CONOUT "Description: $Description"
CONOUT "Activation ID: $licID"
CONOUT "License Status: Unlicensed"
if ($licPHN -NE "empty") {
$gPHN = [String]::IsNullOrEmpty($licPHN) -NE $true
CONOUT "Phone activatable: $($gPHN.ToString())"
}
return
}
$winID = ($strApp -EQ $winApp)
$winPR = ($winID -And -Not $entry.ex)
$Vista = ($winID -And $NT6 -And -Not $NT7)
$NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001)
$win8 = ($strSLP -EQ $wslp -And $NT8)
$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"}
if ($Description | Select-String "VIRTUAL_MACHINE_ACTIVATION") {$cAvmClient = 1; $_mTag = "Automatic VM"}
if ($null -EQ $cKmsClient) {
if ($Description | Select-String "VOLUME_KMS") {$cKmsServer = 1}
if ($Description.Contains("VOLUME_KMSCLIENT")) {$cKmsClient = 1; $actTag = "Volume"}
if ($Description.Contains("TIMEBASED_")) {$cTblClient = 1; $actTag = "Timebased"}
if ($Description.Contains("VIRTUAL_MACHINE_ACTIVATION")) {$cAvmClient = 1; $actTag = "Automatic VM"}
if ($null -EQ $cKmsClient -And $Description.Contains("VOLUME_KMS")) {$cKmsServer = 1}
$gprDay = [Math]::Round($gprMnt/1440)
$_xpr = ""
$inGrace = $false
if ($gprMnt -GT 0) {
$_xpr = [DateTime]::Now.AddMinutes($gprMnt).ToString('yyyy-MM-dd hh:mm:ss tt')
$inGrace = $true
}
$_gpr = [Math]::Round($GracePeriodRemaining/1440)
if ($_gpr -GT 0) {
$_xpr = [DateTime]::Now.AddMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt')
}
$LicenseReason = '0x{0:X}' -f $hrReason
$LicenseMsg = "Time remaining: $GracePeriodRemaining minute(s) ($_gpr day(s))"
$LicenseMsg = "Time remaining: $gprMnt minute(s) ($gprDay day(s))"
if ($LicenseStatus -EQ 0) {
$LicenseInf = "Unlicensed"
$LicenseMsg = $null
}
if ($LicenseStatus -EQ 1) {
$LicenseInf = "Licensed"
if ($GracePeriodRemaining -EQ 0) {
if ($gprMnt -EQ 0) {
$LicenseMsg = $null
$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"}
$LicenseMsg = "$actTag activation expiration: $gprMnt minute(s) ($gprDay day(s))"
if ($inGrace) {$ExpireMsg = "$actTag activation will expire $_xpr"}
}
}
if ($LicenseStatus -EQ 2) {
$LicenseInf = "Initial grace period"
if ($null -NE $_xpr) {$ExpireMsg = "Initial grace period ends $_xpr"}
if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"}
}
if ($LicenseStatus -EQ 3) {
$LicenseInf = "Additional grace period (KMS license expired or hardware out of tolerance)"
if ($null -NE $_xpr) {$ExpireMsg = "Additional grace period ends $_xpr"}
if ($inGrace) {$ExpireMsg = "Additional grace period ends $_xpr"}
}
if ($LicenseStatus -EQ 4) {
$LicenseInf = "Non-genuine grace period"
if ($null -NE $_xpr) {$ExpireMsg = "Non-genuine grace period ends $_xpr"}
if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"}
}
if ($LicenseStatus -EQ 5 -And -Not $NT5) {
$LicenseReason = '0x{0:X}' -f $LicReason
$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)."}}
@@ -835,36 +780,35 @@ function GetResult($strSLP, $strApp, $entry)
}
if ($LicenseStatus -EQ 6 -And -Not $Vista -And -Not $NT5) {
$LicenseInf = "Extended grace period"
if ($null -NE $_xpr) {$ExpireMsg = "Extended grace period ends $_xpr"}
if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"}
}
$pkid = $entry.pk
if ($null -NE $pkid) {
if ($isPPK) {
$propPkey | foreach { set $_ (SlGetInfoPKey $pkid $_) }
}
if ($winPR -And $null -NE $PartialProductKey -And -Not $NT8) {
$uxd = SlGetInfoSku $ID 'UXDifferentiator'
if ($winPR -And $isPPK -And -Not $NT8) {
$uxd = SlGetInfoSku $licID 'UXDifferentiator'
$script:primary += @{
aid = $ID;
aid = $licID;
ppk = $PartialProductKey;
chn = $Channel;
lst = $LicenseStatus;
lcr = $hrReason;
ged = $GracePeriodRemaining;
lcr = $LicReason;
ged = $gprMnt;
evl = $EvaluationEndDate;
dff = $uxd
}
}
if ($IID -And $null -NE $PartialProductKey) {
$OfflineInstallationId = SlGetInfoIID $ID
if ($IID -And $isPPK) {
$OfflineInstallationId = SlGetInfoIID $licID
}
if ($Dlv) {
if ($strSLP -EQ $wslp -And $NT8)
if ($win8)
{
$RemainingSkuReArmCount = SlGetInfoSku $ID 'RemainingRearmCount'
$RemainingSkuReArmCount = SlGetInfoSku $licID 'RemainingRearmCount'
$RemainingAppReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount'
}
else
@@ -884,16 +828,10 @@ function GetResult($strSLP, $strApp, $entry)
}
}
if ($Dlv -Or $All.IsPresent) {
$gPHN = SlCheckInfo $ID "msft:sl/EUL/PHONE/PUBLIC"
}
$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 "Name: $Name"
CONOUT "Description: $Description"
CONOUT "Activation ID: $ID"
CONOUT "Activation ID: $licID"
if ($null -NE $DigitalPID) {CONOUT "Extended PID: $DigitalPID"}
if ($null -NE $DigitalPID2 -And $Dlv) {CONOUT "Product ID: $DigitalPID2"}
if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"}
@@ -905,9 +843,9 @@ function GetResult($strSLP, $strApp, $entry)
$EED = [DateTime]::FromFileTimeUtc($EvaluationEndDate).ToString('yyyy-MM-dd hh:mm:ss tt')
CONOUT "Evaluation End Date: $EED UTC"
}
if ($LicenseStatus -NE 1 -And $null -NE $gPHN) {
$gPHN = $gPHN.ToString()
CONOUT "Phone activatable: $gPHN"
if ($LicenseStatus -NE 1 -And $licPHN -NE "empty") {
$gPHN = [String]::IsNullOrEmpty($licPHN) -NE $true
CONOUT "Phone activatable: $($gPHN.ToString())"
}
if ($Dlv) {
if ($null -NE $RemainingSLReArmCount) {
@@ -922,11 +860,11 @@ function GetResult($strSLP, $strApp, $entry)
CONOUT "Trusted time: $TTD"
}
}
if ($null -EQ $PartialProductKey) {
if (!$isPPK) {
return
}
if ($strSLP -EQ $wslp -And $NT8 -And $VLActivationType -EQ 1) {
if ($win8 -And $VLActivationType -EQ 1) {
DetectAdbaClient
}
@@ -934,7 +872,7 @@ function GetResult($strSLP, $strApp, $entry)
DetectAvmClient
}
$chkSub = ($winPR -And $cSub)
$chkSub = ($winPR -And $isSub)
$chkSLS = ($null -NE $cKmsClient -Or $null -NE $cKmsServer -Or $chkSub)
@@ -943,15 +881,14 @@ function GetResult($strSLP, $strApp, $entry)
return
}
if ($null -NE $cKmsServer) {
DetectKmsHost
}
if ($null -NE $cKmsClient) {
DetectKmsClient
}
if ($null -EQ $cKmsServer) {
if ($null -NE $cKmsServer) {
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
DetectKmsHost
} else {
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
}
@@ -1135,8 +1072,8 @@ function PrintLicensesInformation
function vNextDiagRun
{
$fNUL = ([IO.Directory]::Exists("${env:LOCALAPPDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:LOCALAPPDATA}\Microsoft\Office\Licenses", "*", 1).Length -GE 0)
$fDev = ([IO.Directory]::Exists("${env:PROGRAMDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:PROGRAMDATA}\Microsoft\Office\Licenses", "*", 1).Length -GE 0)
$fNUL = ([IO.Directory]::Exists("${env:LOCALAPPDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:LOCALAPPDATA}\Microsoft\Office\Licenses", "*", 1).Length -GT 0)
$fDev = ([IO.Directory]::Exists("${env:PROGRAMDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:PROGRAMDATA}\Microsoft\Office\Licenses", "*", 1).Length -GT 0)
$rPID = $null -NE (GP "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LicensingNext" -EA 0 | select -Expand 'property' -EA 0 | where -Filter {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"})
$rSCA = $null -NE (GP "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -EA 0 | select -Expand "SharedComputerLicensing" -EA 0)
$rSCL = $null -NE (GP "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing" -EA 0 | select -Expand "SharedComputerLicensing" -EA 0)
@@ -1368,14 +1305,14 @@ function clcGetExpireKrn
$cData = 0
$bData = 0
$ret = $Win32::SLGetWindowsInformation(
$hrRet = $Win32::SLGetWindowsInformation(
"Kernel-ExpirationDate",
[ref]$tData,
[ref]$cData,
[ref]$bData
)
if ($ret -Or !$cData -Or $tData -NE 3)
if ($hrRet -Or !$cData -Or $tData -NE 3)
{
return $null
}
@@ -1390,7 +1327,7 @@ function clcGetExpireKrn
$rData = '{0}/{1}/{2}:{3}:{4}:{5}' -f $year, $Marshal::ReadInt16($bData, 2), $Marshal::ReadInt16($bData, 4), $Marshal::ReadInt16($bData, 6), $Marshal::ReadInt16($bData, 8), $Marshal::ReadInt16($bData, 10)
}
$Marshal::FreeHGlobal($bData)
#$Marshal::FreeHGlobal($bData)
return $rData
}
@@ -1403,7 +1340,7 @@ function clcGetExpireSys
return $null
}
$rData = [DateTime]::FromFileTimeUTC($kuser).ToString('yyyy/MM/dd:HH:mm:ss')
$rData = [DateTime]::FromFileTimeUtc($kuser).ToString('yyyy/MM/dd:HH:mm:ss')
return $rData
}
@@ -1426,12 +1363,12 @@ function clcGetGenuineState($AppId)
$dwGenuine = 0
if ($NT7) {
$ret = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine)
$hrRet = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine)
} else {
$ret = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0)
$hrRet = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0)
}
if ($ret)
if ($hrRet)
{
$dwGenuine = 4
}
@@ -1499,7 +1436,7 @@ $osls = "OfficeSoftwareProtectionService"
$winApp = "55c92734-d682-4d71-983e-d6ec3f16059f"
$o14App = "59a52881-a989-479d-af46-f275c6370663"
$o15App = "0ff1ce15-a989-479d-af46-f275c6370663"
$cSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType")
$isSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType")
$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")

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -60,6 +60,8 @@ exit /b
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -144,15 +146,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
goto done2
)
if not exist %ps% (
if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
%nceline%
if not exist %ps% (
echo PowerShell is not installed in your system.
if %winbuild% LSS 7600 (
echo Install PowerShell using the following URL.
)
echo Install PowerShell 2.0 using the following URL.
echo:
echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
)
if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
goto done2
)
@@ -208,12 +210,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -243,7 +247,13 @@ goto done2
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -325,7 +335,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
@@ -731,7 +741,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (

View File

@@ -1,4 +1,4 @@
@set masver=3.0
@set masver=3.3
@echo off
@@ -60,6 +60,8 @@ exit /b
set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
:: Check if Null service is working, it's important for the batch script
@@ -145,15 +147,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
goto dk_done
)
if not exist %ps% (
if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
%nceline%
if not exist %ps% (
echo PowerShell is not installed in your system.
if %winbuild% LSS 7600 (
echo Install PowerShell using the following URL.
)
echo Install PowerShell 2.0 using the following URL.
echo:
echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
)
if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
goto dk_done
)
@@ -209,12 +211,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
if /i not "%tstresult%"=="FullLanguage" (
%eline%
echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
echo Test 1 - %tstresult%
echo Test 2 - !tstresult2!
echo:
REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
@@ -244,7 +248,13 @@ goto dk_done
REM check antivirus and other errors
echo PowerShell is not working properly. Aborting...
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 }"""
if /i "!tstresult2!"=="FullLanguage" (
echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
)
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@@ -326,7 +336,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 %mas% & exit /b)
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
)
)
@@ -387,7 +397,7 @@ if %_erl%==5 goto:retokens
if %_erl%==4 goto:fixwmi
if %_erl%==3 goto:sfcscan
if %_erl%==2 goto:dism_rest
if %_erl%==1 start %mas%troubleshoot.html &goto at_menu
if %_erl%==1 (start %selfgit% & start %github% & start %mas%troubleshoot & goto at_menu)
goto :at_menu
::========================================================================================================================================
@@ -733,7 +743,7 @@ for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsof
if %winbuild% LSS 9200 if not defined _vis (
REM Fix issues caused by Update KB971033 in Windows 7
REM https://support.microsoft.com/help/4487266
REM https://support.microsoft.com/en-us/help/4487266
echo:
echo Checking Update KB971033...
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
@@ -874,12 +884,12 @@ set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15)
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%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.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\*Picker.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" & 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)
@@ -1178,7 +1188,7 @@ goto :at_menu
:: https://stackoverflow.com/a/46268232
set "ddf="%SystemRoot%\Temp\ddf""
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
%nul% del /q /f %ddf%
echo/.New Cabinet>%ddf%
echo/.set Cabinet=ON>>%ddf%
@@ -1230,7 +1240,7 @@ set "permerror=Error Found In SPP Registries"
)
)
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
@@ -1276,7 +1286,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
}
# Fix perms for SPP in HKU\S-1-5-20
# https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
# https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') {
exit
@@ -1488,7 +1498,8 @@ 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 %%#))
if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (

225
README.md
View File

@@ -1,109 +1,116 @@
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
<hr>
## Download / How to use it?
### Method 1 - PowerShell (Windows 8 and later) ❤️
1. Open PowerShell (Not CMD). To do that, right-click on the Windows start menu and select PowerShell or Terminal.
2. Copy and paste the code below and press enter
```
irm https://get.activated.win | iex
```
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.
4. That's all.
---
### Method 2 - Traditional (Windows 7 and later)
<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.
</details>
---
### 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: 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>
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
<hr>
## How to Activate Windows / Office?
### Method 1 - PowerShell (Windows 8 and later) ❤️
1. **Open PowerShell**
To do that, press the Windows key + X, then select PowerShell or Terminal.
2. **Copy and paste the code below, then press enter.**
```
irm https://get.activated.win | iex
```
Alternatively, you can use the following (this will be deprecated in the future):
```
irm https://massgrave.dev/get | iex
```
3. You will see the activation options. Choose the activation options highlighted in green.
4. That's all
---
### Method 2 - Traditional (Windows Vista and later)
<details>
<summary>Click here to view</summary>
1. Download the file using one of the links 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 it.
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.
</details>
---
- To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation).
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
---
### 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.
---
```
Latest Version: 3.3
Release date: 1-June-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>