mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-07-05 09:21:19 +01:00
Compare commits
69 Commits
c316b42e5c
...
dev
Author | SHA1 | Date | |
---|---|---|---|
c817ae8bd9 | |||
ef411e14ca | |||
5aa7d4f3de | |||
409c4f71ad | |||
d7a6994363 | |||
5ad6226f37 | |||
ae9f4e34ff | |||
67abcd0c89 | |||
faf3bf3a08 | |||
482600c890 | |||
dc90e1ff0f | |||
f969378f6b | |||
c89bebdee8 | |||
be7d101df5 | |||
55b6fce50a | |||
6566bb53c1 | |||
2e44a4a77b | |||
9073a35fe0 | |||
9f244ddc17 | |||
8ed0c6874b | |||
a99acbb025 | |||
be867f6616 | |||
fc80735dac | |||
69c469a997 | |||
6e74d49721 | |||
ae93f547f5 | |||
830755f6b6 | |||
a149fc5f20 | |||
b75ba72bc5 | |||
206c31ece5 | |||
133d3b9720 | |||
fc2348bf53 | |||
966fbd14f6 | |||
691e6088d5 | |||
74b7c74218 | |||
4c53e6231b | |||
2d00dfa704 | |||
bf28e4fbdd | |||
2a2352428e | |||
be9215b728 | |||
93cf3864f5 | |||
d47a750bad | |||
817bfe84de | |||
2b40259b33 | |||
a514a99d0e | |||
2a806c2e0c | |||
b3aaff5110 | |||
bcc4214e8a | |||
9e80556df5 | |||
b24bb9bde1 | |||
dfebdefeba | |||
1bdee1ce6f | |||
4e702068be | |||
6945236590 | |||
5872b7df53 | |||
b8ad749bac | |||
5090cde0a0 | |||
af18bd773c | |||
52ba9f138f | |||
98ef9db3ce | |||
172fd7b1c5 | |||
372eb73a02 | |||
a1614e1283 | |||
e8bf344f74 | |||
70162c4130 | |||
294837dfe0 | |||
f5a0a63165 | |||
0d61475468 | |||
313f240448 |
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=3.0
|
||||
@set masver=3.4
|
||||
@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
|
||||
|
||||
@ -235,16 +237,18 @@ goto dk_done
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
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,17 @@ 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.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
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"
|
||||
@ -295,7 +309,9 @@ set terminal=
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
@ -356,7 +372,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,8 +397,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
|
||||
)
|
||||
)
|
||||
@ -490,7 +511,7 @@ set notworking=
|
||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if defined allapps call :hwiddata key
|
||||
if not defined key (
|
||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getactivationid\:.*';iex ($f[1])"') do (set altapplist=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';& ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a)
|
||||
if defined altapplist call :hwiddata key
|
||||
)
|
||||
|
||||
@ -538,6 +559,7 @@ call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script w
|
||||
echo:
|
||||
)
|
||||
|
||||
set generickey=1
|
||||
call :dk_inskey "[%key%]"
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -808,10 +830,16 @@ goto :dk_done
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe -nop -c
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
@ -894,7 +922,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
|
||||
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
|
||||
if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && (
|
||||
if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && (
|
||||
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
|
||||
set winsub=1
|
||||
set osSKU=%regSKU%
|
||||
@ -951,11 +979,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%"
|
||||
@ -964,6 +993,7 @@ set showfix=1
|
||||
set error=1
|
||||
)
|
||||
|
||||
set generickey=
|
||||
exit /b
|
||||
|
||||
:: Activation command
|
||||
@ -1002,6 +1032,8 @@ exit /b
|
||||
|
||||
:dk_reeval
|
||||
|
||||
if %winbuild% LSS 7600 exit /b
|
||||
|
||||
:: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP
|
||||
|
||||
set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState"
|
||||
@ -1047,13 +1079,13 @@ function InstallLicenseArr($Str) {
|
||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||
}
|
||||
function InstallLicenseDir($Loc) {
|
||||
dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"}
|
||||
Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName}
|
||||
}
|
||||
function ReinstallLicenses() {
|
||||
$Oem = "$env:SysPath\oem"
|
||||
$Spp = "$env:SysPath\spp\tokens"
|
||||
InstallLicenseDir "$Spp"
|
||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
||||
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||
foreach ($Path in $Paths) {
|
||||
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||
}
|
||||
}
|
||||
:xrm:
|
||||
|
||||
@ -1061,6 +1093,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
|
||||
@ -1071,16 +1104,16 @@ exit /b
|
||||
|
||||
:dk_sppissue
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
set spperror=%errorlevel%
|
||||
|
||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||
%eline%
|
||||
echo sc start sppsvc [Error Code: %spperror%]
|
||||
echo sc start %_slser% [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
@ -1088,7 +1121,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)
|
||||
@ -1144,17 +1177,17 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
) || (
|
||||
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
)
|
||||
|
||||
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:
|
||||
@ -1228,6 +1261,7 @@ for %%# in (%serv_ste%) do (
|
||||
if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%)
|
||||
if /i %%#==wlidsvc sc config %%# start= demand %nul%
|
||||
if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%)
|
||||
if /i %%#==SLsvc sc config %%# start= auto %nul%
|
||||
if /i %%#==KeyIso sc config %%# start= demand %nul%
|
||||
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
||||
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
||||
@ -1292,7 +1326,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)
|
||||
|
||||
@ -1319,7 +1353,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
|
||||
|
||||
set wpainfo=
|
||||
set wpaerror=
|
||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
|
||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
@ -1357,19 +1391,22 @@ if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) else (
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||
set skunotfound=1
|
||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
||||
)
|
||||
|
||||
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%"
|
||||
@ -1439,7 +1476,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m
|
||||
)
|
||||
|
||||
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
@ -1453,14 +1490,14 @@ echo Checking SPP In IFEO [%_sppint%]
|
||||
)
|
||||
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
)
|
||||
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
@ -1470,21 +1507,22 @@ set showfix=1
|
||||
|
||||
|
||||
set tokenstore=
|
||||
if %winbuild% GEQ 7600 (
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b"
|
||||
if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform"
|
||||
if %winbuild% GEQ 9200 if /i not "%tokenstore%"=="%SysPath%\spp\store" if /i not "%tokenstore%"=="%SysPath%\spp\store\2.0" if /i not "%tokenstore%"=="%SysPath%\spp\store_test\2.0" (
|
||||
if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" (
|
||||
set toerr=1
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
:: This code creates token folder only if it's missing and sets default permission for it
|
||||
|
||||
if not defined toerr if not exist "%tokenstore%\" (
|
||||
if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" (
|
||||
mkdir "%tokenstore%" %nul%
|
||||
if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';"
|
||||
if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';"
|
||||
@ -1505,7 +1543,7 @@ set showfix=1
|
||||
if not defined notwinact (
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
@ -1520,7 +1558,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
|
||||
)
|
||||
|
||||
|
||||
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
||||
)
|
||||
@ -1559,7 +1597,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% && (
|
||||
@ -1655,8 +1693,10 @@ $wpaKey.Close()
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1664,8 +1704,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1680,7 +1722,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 (
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=3.0
|
||||
@set masver=3.4
|
||||
@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
|
||||
|
||||
@ -238,16 +240,18 @@ goto dk_done
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
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,17 @@ 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.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
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"
|
||||
@ -298,7 +312,9 @@ set terminal=
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
@ -359,7 +375,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,8 +437,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
|
||||
)
|
||||
|
||||
@ -617,6 +638,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [
|
||||
)
|
||||
|
||||
if defined key (
|
||||
set generickey=1
|
||||
call :dk_inskey "[%key%]"
|
||||
)
|
||||
|
||||
@ -645,7 +667,7 @@ echo:
|
||||
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
|
||||
|
||||
%nul% reg query "HKLM\%specific_kms%" && (
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))"
|
||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||
)
|
||||
|
||||
@ -715,12 +737,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%
|
||||
@ -821,7 +837,7 @@ echo Removing the Added Specific KMS Host [Successful]
|
||||
:: Protect KMS38 if opted by the user and conditions are correct
|
||||
|
||||
if defined _k38 (
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
|
||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||
%nul% reg query "HKLM\%specific_kms%" && (
|
||||
echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
|
||||
@ -865,7 +881,7 @@ title Remove KMS38 Protection %masver%
|
||||
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
|
||||
|
||||
%nul% reg query "HKLM\%specific_kms%" && (
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))"
|
||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||
)
|
||||
|
||||
@ -914,10 +930,16 @@ $key.SetAccessControl($acl)
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe -nop -c
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
@ -1000,7 +1022,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
|
||||
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
|
||||
if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && (
|
||||
if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && (
|
||||
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
|
||||
set winsub=1
|
||||
set osSKU=%regSKU%
|
||||
@ -1076,11 +1098,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%"
|
||||
@ -1089,6 +1112,7 @@ set showfix=1
|
||||
set error=1
|
||||
)
|
||||
|
||||
set generickey=
|
||||
exit /b
|
||||
|
||||
:: Get Windows installed key channel
|
||||
@ -1124,6 +1148,8 @@ exit /b
|
||||
|
||||
:dk_reeval
|
||||
|
||||
if %winbuild% LSS 7600 exit /b
|
||||
|
||||
:: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP
|
||||
|
||||
set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState"
|
||||
@ -1151,13 +1177,13 @@ function InstallLicenseArr($Str) {
|
||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||
}
|
||||
function InstallLicenseDir($Loc) {
|
||||
dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"}
|
||||
Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName}
|
||||
}
|
||||
function ReinstallLicenses() {
|
||||
$Oem = "$env:SysPath\oem"
|
||||
$Spp = "$env:SysPath\spp\tokens"
|
||||
InstallLicenseDir "$Spp"
|
||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
||||
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||
foreach ($Path in $Paths) {
|
||||
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||
}
|
||||
}
|
||||
:xrm:
|
||||
|
||||
@ -1165,6 +1191,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
|
||||
@ -1175,16 +1202,16 @@ exit /b
|
||||
|
||||
:dk_sppissue
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
set spperror=%errorlevel%
|
||||
|
||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||
%eline%
|
||||
echo sc start sppsvc [Error Code: %spperror%]
|
||||
echo sc start %_slser% [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
@ -1192,7 +1219,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)
|
||||
@ -1293,17 +1320,17 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
) || (
|
||||
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
)
|
||||
|
||||
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:
|
||||
@ -1377,6 +1404,7 @@ for %%# in (%serv_ste%) do (
|
||||
if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%)
|
||||
if /i %%#==wlidsvc sc config %%# start= demand %nul%
|
||||
if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%)
|
||||
if /i %%#==SLsvc sc config %%# start= auto %nul%
|
||||
if /i %%#==KeyIso sc config %%# start= demand %nul%
|
||||
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
||||
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
||||
@ -1441,7 +1469,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)
|
||||
|
||||
@ -1468,7 +1496,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
|
||||
|
||||
set wpainfo=
|
||||
set wpaerror=
|
||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
|
||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
@ -1506,19 +1534,22 @@ if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) else (
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||
set skunotfound=1
|
||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
||||
)
|
||||
|
||||
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%"
|
||||
@ -1588,7 +1619,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m
|
||||
)
|
||||
|
||||
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
@ -1602,14 +1633,14 @@ echo Checking SPP In IFEO [%_sppint%]
|
||||
)
|
||||
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
)
|
||||
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
@ -1619,21 +1650,22 @@ set showfix=1
|
||||
|
||||
|
||||
set tokenstore=
|
||||
if %winbuild% GEQ 7600 (
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b"
|
||||
if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform"
|
||||
if %winbuild% GEQ 9200 if /i not "%tokenstore%"=="%SysPath%\spp\store" if /i not "%tokenstore%"=="%SysPath%\spp\store\2.0" if /i not "%tokenstore%"=="%SysPath%\spp\store_test\2.0" (
|
||||
if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" (
|
||||
set toerr=1
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
:: This code creates token folder only if it's missing and sets default permission for it
|
||||
|
||||
if not defined toerr if not exist "%tokenstore%\" (
|
||||
if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" (
|
||||
mkdir "%tokenstore%" %nul%
|
||||
if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';"
|
||||
if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';"
|
||||
@ -1654,7 +1686,7 @@ set showfix=1
|
||||
if not defined notwinact (
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
@ -1669,7 +1701,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
|
||||
)
|
||||
|
||||
|
||||
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
||||
)
|
||||
@ -1708,7 +1740,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% && (
|
||||
@ -1804,8 +1836,10 @@ $wpaKey.Close()
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1813,8 +1847,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1829,7 +1865,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 (
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=3.0
|
||||
@set masver=3.4
|
||||
@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
|
||||
|
||||
@ -134,9 +136,9 @@ goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -188,16 +190,18 @@ goto dk_done
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
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,17 @@ 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.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
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"
|
||||
@ -248,7 +262,9 @@ set terminal=
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
@ -309,7 +325,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 +339,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 +372,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 +421,7 @@ _updch
|
||||
_lang
|
||||
_clversion
|
||||
_version
|
||||
_AudienceData
|
||||
_oIds
|
||||
_c2rXml
|
||||
_c2rExe
|
||||
@ -544,7 +551,7 @@ goto :oe_edition
|
||||
cls
|
||||
call :ch_getinfo
|
||||
call :oe_tempcleanup
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';& ([scriptblock]::Create($f[1]))"
|
||||
|
||||
:oe_editionchange
|
||||
|
||||
@ -618,7 +625,7 @@ cls
|
||||
set suites=
|
||||
echo %list% | find /i "Suites" %nul1% && (
|
||||
set suites=1
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getappnames\:.*';iex ($f[1])"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';& ([scriptblock]::Create($f[1]))"
|
||||
if not exist %SystemRoot%\Temp\getAppIds.txt (
|
||||
%eline%
|
||||
echo Failed to generate available apps list.
|
||||
@ -802,8 +809,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 +1019,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 +1033,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 +1092,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%!
|
||||
@ -1058,18 +1106,136 @@ if not defined terminal mode 105, 32
|
||||
:: Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results
|
||||
|
||||
set build=
|
||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';& ([scriptblock]::Create($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 +1252,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 +1275,7 @@ set _oRoot=
|
||||
set _oArch=
|
||||
set _updch=
|
||||
set _oIds=
|
||||
set _firstoId=
|
||||
set _lang=
|
||||
set _cfolder=
|
||||
set _version=
|
||||
@ -1174,9 +1306,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 +1328,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
|
||||
|
||||
@ -1352,10 +1485,16 @@ if ($appIdsList.Count -gt 0) {
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe -nop -c
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
@ -1402,6 +1541,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
|
||||
@ -1412,16 +1552,16 @@ exit /b
|
||||
|
||||
:dk_sppissue
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
set spperror=%errorlevel%
|
||||
|
||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||
%eline%
|
||||
echo sc start sppsvc [Error Code: %spperror%]
|
||||
echo sc start %_slser% [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
@ -1439,8 +1579,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1448,8 +1590,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1464,7 +1608,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 (
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=3.0
|
||||
@set masver=3.4
|
||||
@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
|
||||
|
||||
@ -139,9 +141,9 @@ goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -193,16 +195,18 @@ goto dk_done
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
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,17 @@ 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.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
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"
|
||||
@ -253,7 +267,9 @@ set terminal=
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
@ -314,7 +330,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)
|
||||
)
|
||||
)
|
||||
|
||||
@ -354,6 +370,9 @@ if not exist %SysPath%\%%# (
|
||||
%eline%
|
||||
echo [%SysPath%\%%#] file is missing, aborting...
|
||||
echo:
|
||||
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
|
||||
@ -387,8 +406,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
|
||||
)
|
||||
|
||||
@ -410,8 +428,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
|
||||
)
|
||||
|
||||
@ -434,7 +451,7 @@ set _ntarget=
|
||||
set _wtarget=
|
||||
|
||||
if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a "))
|
||||
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
||||
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
||||
|
||||
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
if %winbuild% GEQ 17063 call :ced_edilist
|
||||
@ -640,7 +657,7 @@ echo:
|
||||
call :ced_prep
|
||||
if defined preperror goto dk_done
|
||||
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%"
|
||||
call :ced_postprep
|
||||
)
|
||||
%line%
|
||||
@ -678,7 +695,7 @@ call :ced_prep
|
||||
if defined preperror goto dk_done
|
||||
|
||||
if %_stg%==0 (set stage=) else (set stage=-StageCurrent)
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%"
|
||||
call :ced_postprep
|
||||
%line%
|
||||
|
||||
@ -792,7 +809,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%
|
||||
@ -824,10 +841,16 @@ exit /b
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe -nop -c
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
@ -901,6 +924,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
|
||||
@ -911,16 +935,16 @@ exit /b
|
||||
|
||||
:dk_sppissue
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
set spperror=%errorlevel%
|
||||
|
||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||
%eline%
|
||||
echo sc start sppsvc [Error Code: %spperror%]
|
||||
echo sc start %_slser% [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
@ -1018,8 +1042,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1027,8 +1053,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -1043,7 +1071,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 (
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=3.0
|
||||
@set masver=3.4
|
||||
@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
|
||||
|
||||
@ -129,13 +131,30 @@ echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
goto done2
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/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:
|
||||
echo Windows Vista RTM is not supported because Powershell cannot be installed.
|
||||
echo Upgrade to Windows Vista SP1 or SP2.
|
||||
)
|
||||
goto done2
|
||||
)
|
||||
|
||||
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 done2
|
||||
)
|
||||
|
||||
@ -187,16 +206,18 @@ goto done2
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
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:
|
||||
@ -226,7 +247,17 @@ 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.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
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"
|
||||
@ -247,7 +278,9 @@ set terminal=
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
@ -308,7 +341,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)
|
||||
)
|
||||
)
|
||||
|
||||
@ -714,7 +747,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 (
|
||||
@ -732,10 +766,16 @@ exit /b
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe -nop -c
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
@ -782,7 +822,7 @@ exit /b
|
||||
|
||||
:export
|
||||
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -791,8 +831,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@ -800,8 +842,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=3.0
|
||||
@set masver=3.4
|
||||
@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
|
||||
|
||||
@ -133,10 +135,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/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:
|
||||
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
|
||||
)
|
||||
|
||||
@ -188,16 +207,18 @@ goto dk_done
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
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 +248,17 @@ 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.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
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"
|
||||
@ -248,7 +279,9 @@ set terminal=
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
@ -309,7 +342,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)
|
||||
)
|
||||
)
|
||||
|
||||
@ -370,7 +403,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
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -515,6 +548,13 @@ mode 125, 32
|
||||
)
|
||||
title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^)
|
||||
|
||||
if %winbuild% EQU 6001 (
|
||||
%eline%
|
||||
echo This option is not supported on Windows Vista SP1.
|
||||
echo Upgrade to Windows Vista SP2.
|
||||
goto :at_back
|
||||
)
|
||||
|
||||
echo:
|
||||
echo %line%
|
||||
echo:
|
||||
@ -531,7 +571,7 @@ echo - Clear ClipSVC, SPP and OSPP licenses.
|
||||
echo - Fix permissions of SPP tokens folder and registries.
|
||||
echo - Trigger the repair option for Office.
|
||||
echo:
|
||||
call :dk_color2 %_White% " - " %Red% "Apply this option only when it is necessary."
|
||||
call :dk_color2 %_White% " - " %Blue% "Apply this option only when it is necessary."
|
||||
echo:
|
||||
echo %line%
|
||||
echo:
|
||||
@ -682,7 +722,7 @@ echo Checking SPP permission related issues...
|
||||
call :checkperms
|
||||
if defined permerror (
|
||||
call :dk_color %Red% "[!permerror!]"
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';iex ($f[1])" %nul%
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';& ([scriptblock]::Create($f[1]))" %nul%
|
||||
call :checkperms
|
||||
if defined permerror (
|
||||
call :dk_color %Red% "[!permerror!] [Failed To Fix]"
|
||||
@ -695,21 +735,21 @@ echo [No Error Found]
|
||||
)
|
||||
|
||||
echo:
|
||||
echo Stopping sppsvc service...
|
||||
%psc% Stop-Service sppsvc -force %nul%
|
||||
echo Stopping %_slser% service...
|
||||
%psc% Stop-Service %_slser% -force %nul%
|
||||
|
||||
set w=
|
||||
set _sppint=
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1))
|
||||
for %%# in (SppEx%w%tComObj.exe %_slexe%) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1))
|
||||
if defined _sppint (
|
||||
echo:
|
||||
echo Removing SPP IFEO registry keys...
|
||||
for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%)
|
||||
for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 9200 (
|
||||
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%
|
||||
@ -726,6 +766,7 @@ del /f /q %SysPath%\7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-81
|
||||
|
||||
:: Delete registry keys that are not deleted by activation scripts
|
||||
|
||||
if not defined _vis (
|
||||
echo:
|
||||
echo Cleaning some licensing-related registry keys...
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f
|
||||
@ -733,6 +774,7 @@ echo Cleaning some licensing-related registry keys...
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "PolicyValuesArray" /f
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f
|
||||
)
|
||||
|
||||
echo:
|
||||
call :scandat delete
|
||||
@ -744,10 +786,14 @@ call :dk_color %Red% "Failed to delete .dat files."
|
||||
echo:
|
||||
)
|
||||
|
||||
if defined _vis (
|
||||
%psc% Start-Service %_slser% %nul%
|
||||
)
|
||||
|
||||
echo:
|
||||
echo Reinstalling system licenses...
|
||||
%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||
if %errorlevel% EQU 0 (
|
||||
echo [Successful]
|
||||
) else (
|
||||
@ -763,7 +809,7 @@ call :dk_color %Red% "Failed to rebuild tokens.dat file."
|
||||
echo tokens.dat file was rebuilt successfully.
|
||||
)
|
||||
|
||||
if %winbuild% LSS 9200 (
|
||||
if %winbuild% LSS 9200 if not defined _vis (
|
||||
sc config sppuinotify start= demand
|
||||
)
|
||||
|
||||
@ -844,12 +890,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)
|
||||
@ -1148,7 +1194,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%
|
||||
@ -1200,7 +1246,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% && (
|
||||
@ -1246,7 +1292,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
|
||||
@ -1329,13 +1375,13 @@ function InstallLicenseArr($Str) {
|
||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||
}
|
||||
function InstallLicenseDir($Loc) {
|
||||
dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"}
|
||||
Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName}
|
||||
}
|
||||
function ReinstallLicenses() {
|
||||
$Oem = "$env:SysPath\oem"
|
||||
$Spp = "$env:SysPath\spp\tokens"
|
||||
InstallLicenseDir "$Spp"
|
||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
||||
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||
foreach ($Path in $Paths) {
|
||||
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||
}
|
||||
}
|
||||
:xrm:
|
||||
|
||||
@ -1349,6 +1395,7 @@ for %%# in (
|
||||
%SysPath%\spp\store\
|
||||
%SysPath%\spp\store\2.0\
|
||||
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
|
||||
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\
|
||||
) do (
|
||||
|
||||
if %1==check (
|
||||
@ -1392,7 +1439,7 @@ exit /b
|
||||
|
||||
:regownstart
|
||||
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regown\:.*';iex ($f[1]);"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';& ([scriptblock]::Create($f[1]));"
|
||||
exit /b
|
||||
|
||||
:: Below code takes ownership of a volatile registry key and deletes it
|
||||
@ -1424,14 +1471,41 @@ $key.SetAccessControl($acl)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_color
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
:dk_color2
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_done
|
||||
|
||||
echo:
|
||||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
if !errorlevel!==2 exit /b
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
||||
if defined terminal (
|
||||
@ -1441,26 +1515,7 @@ choice /c 0 /n
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
pause %nul1%
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_color
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
)
|
||||
exit /b
|
||||
|
||||
:dk_color2
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1469,10 +1524,16 @@ exit /b
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe -nop -c
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
41
README.md
41
README.md
@ -6,43 +6,52 @@
|
||||
|
||||
<hr>
|
||||
|
||||
## Download / How to use it?
|
||||
## How to Activate Windows / Office?
|
||||
|
||||
### 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
|
||||
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 (It will be deprecated in the future.)
|
||||
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 (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
|
||||
4. That's all.
|
||||
|
||||
3. You will see the activation options. Choose the activation options highlighted in green.
|
||||
|
||||
4. That's all
|
||||
|
||||
---
|
||||
|
||||
### Method 2 - Traditional (Windows 7 and later)
|
||||
### Method 2 - Traditional (Windows Vista and later)
|
||||
|
||||
<details>
|
||||
<summary>Click here for info</summary>
|
||||
<summary>Click here to view</summary>
|
||||
|
||||
1. Download the file using the links provided below.
|
||||
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
|
||||
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.
|
||||
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.
|
||||
@ -59,11 +68,9 @@ or
|
||||
|
||||
---
|
||||
|
||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
||||
|
||||
```
|
||||
Latest Version: 3.0
|
||||
Release date: 14-Feb-2025
|
||||
Latest Version: 3.4
|
||||
Release date: 3-June-2025
|
||||
```
|
||||
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||
|
Reference in New Issue
Block a user