mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-07-05 09:21:19 +01:00
Compare commits
56 Commits
c316b42e5c
...
3.3
Author | SHA1 | Date | |
---|---|---|---|
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 |
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -1,4 +1,4 @@
|
|||||||
# MAS export-ignore
|
MAS export-ignore
|
||||||
# LICENSE export-ignore
|
LICENSE export-ignore
|
||||||
# README.md export-ignore
|
README.md export-ignore
|
||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -100,6 +100,8 @@ set "nul="
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: 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
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -274,7 +278,13 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -356,7 +366,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -381,8 +391,13 @@ if not exist %SysPath%\%%# (
|
|||||||
%eline%
|
%eline%
|
||||||
echo [%SysPath%\%%#] file is missing, aborting...
|
echo [%SysPath%\%%#] file is missing, aborting...
|
||||||
echo:
|
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
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
)
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -538,6 +553,7 @@ call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script w
|
|||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set generickey=1
|
||||||
call :dk_inskey "[%key%]"
|
call :dk_inskey "[%key%]"
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@ -808,10 +824,16 @@ goto :dk_done
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
@ -951,11 +973,12 @@ set keyerror=%errorlevel%
|
|||||||
cmd /c exit /b %keyerror%
|
cmd /c exit /b %keyerror%
|
||||||
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
|
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 %keyerror% EQU 0 (
|
||||||
if %sps%==SoftwareLicensingService call :dk_refresh
|
if %sps%==SoftwareLicensingService call :dk_refresh
|
||||||
echo Installing Generic Product Key %~1 [Successful]
|
echo %keyecho% %~1 [Successful]
|
||||||
) else (
|
) 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 not defined error (
|
||||||
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
||||||
call :dk_color %Blue% "%_fixmsg%"
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
@ -964,6 +987,7 @@ set showfix=1
|
|||||||
set error=1
|
set error=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set generickey=
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Activation command
|
:: Activation command
|
||||||
@ -1002,6 +1026,8 @@ exit /b
|
|||||||
|
|
||||||
:dk_reeval
|
: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
|
:: 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"
|
set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState"
|
||||||
@ -1047,13 +1073,13 @@ function InstallLicenseArr($Str) {
|
|||||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||||
}
|
}
|
||||||
function InstallLicenseDir($Loc) {
|
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() {
|
function ReinstallLicenses() {
|
||||||
$Oem = "$env:SysPath\oem"
|
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||||
$Spp = "$env:SysPath\spp\tokens"
|
foreach ($Path in $Paths) {
|
||||||
InstallLicenseDir "$Spp"
|
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
}
|
||||||
}
|
}
|
||||||
:xrm:
|
:xrm:
|
||||||
|
|
||||||
@ -1061,6 +1087,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
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
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1071,16 +1098,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_sppissue
|
:dk_sppissue
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start %_slser% %nul%
|
||||||
set spperror=%errorlevel%
|
set spperror=%errorlevel%
|
||||||
|
|
||||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||||
%eline%
|
%eline%
|
||||||
echo sc start sppsvc [Error Code: %spperror%]
|
echo sc start %_slser% [Error Code: %spperror%]
|
||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
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
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@ -1088,7 +1115,7 @@ exit /b
|
|||||||
:dk_product
|
:dk_product
|
||||||
|
|
||||||
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
|
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=
|
set winos=
|
||||||
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
|
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
|
||||||
@ -1144,17 +1171,17 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
|||||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
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% && (
|
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||||
set "results=%results%[Likely File Infector]"
|
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 not "%results%%pupfound%"=="" (
|
||||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%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% "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
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
@ -1228,6 +1255,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 %%#==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 %%#==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 %%#==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 %%#==KeyIso sc config %%# start= demand %nul%
|
||||||
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
||||||
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
||||||
@ -1292,7 +1320,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||||
|
|
||||||
@ -1357,19 +1385,22 @@ if %osedition%==0 (
|
|||||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||||
) else (
|
) 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
|
set skunotfound=1
|
||||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
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%-*.mum" (
|
||||||
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
|
||||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
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%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
@ -1439,7 +1470,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=%%#"))
|
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 (
|
if defined _sppint (
|
||||||
@ -1453,14 +1484,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%
|
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]"
|
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"
|
%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]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
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"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
@ -1470,21 +1501,22 @@ set showfix=1
|
|||||||
|
|
||||||
|
|
||||||
set tokenstore=
|
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"
|
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% 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 toerr=1
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=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
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %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
|
:: 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%
|
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% 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)';"
|
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 +1537,7 @@ set showfix=1
|
|||||||
if not defined notwinact (
|
if not defined notwinact (
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||||
@ -1520,7 +1552,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
|
set error=1
|
||||||
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
||||||
)
|
)
|
||||||
@ -1559,7 +1591,7 @@ set "permerror=Error Found In SPP Registries"
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
if not defined permerror (
|
if not defined permerror (
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
@ -1655,8 +1687,10 @@ $wpaKey.Close()
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else if exist %ps% (
|
||||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
|
) else if not exist %ps% (
|
||||||
|
echo %~3
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1664,8 +1698,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
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'
|
%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
|
exit /b
|
||||||
|
|
||||||
@ -1680,7 +1716,8 @@ if defined fixes (
|
|||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -103,6 +103,8 @@ set "nul="
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: 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
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -277,7 +281,13 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -359,7 +369,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
cls
|
cls
|
||||||
@ -421,8 +431,13 @@ if defined _fmiss (
|
|||||||
%eline%
|
%eline%
|
||||||
echo [%_fmiss%] file is missing, aborting...
|
echo [%_fmiss%] file is missing, aborting...
|
||||||
echo:
|
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
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
)
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -617,6 +632,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [
|
|||||||
)
|
)
|
||||||
|
|
||||||
if defined key (
|
if defined key (
|
||||||
|
set generickey=1
|
||||||
call :dk_inskey "[%key%]"
|
call :dk_inskey "[%key%]"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -715,12 +731,6 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||||||
|
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
|
|
||||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
|
||||||
echo Stopping sppsvc Service [Successful]
|
|
||||||
) || (
|
|
||||||
call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|
||||||
)
|
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
@ -914,10 +924,16 @@ $key.SetAccessControl($acl)
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
@ -1076,11 +1092,12 @@ set keyerror=%errorlevel%
|
|||||||
cmd /c exit /b %keyerror%
|
cmd /c exit /b %keyerror%
|
||||||
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
|
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 %keyerror% EQU 0 (
|
||||||
if %sps%==SoftwareLicensingService call :dk_refresh
|
if %sps%==SoftwareLicensingService call :dk_refresh
|
||||||
echo Installing Generic Product Key %~1 [Successful]
|
echo %keyecho% %~1 [Successful]
|
||||||
) else (
|
) 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 not defined error (
|
||||||
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
||||||
call :dk_color %Blue% "%_fixmsg%"
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
@ -1089,6 +1106,7 @@ set showfix=1
|
|||||||
set error=1
|
set error=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set generickey=
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Windows installed key channel
|
:: Get Windows installed key channel
|
||||||
@ -1124,6 +1142,8 @@ exit /b
|
|||||||
|
|
||||||
:dk_reeval
|
: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
|
:: 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"
|
set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState"
|
||||||
@ -1151,13 +1171,13 @@ function InstallLicenseArr($Str) {
|
|||||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||||
}
|
}
|
||||||
function InstallLicenseDir($Loc) {
|
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() {
|
function ReinstallLicenses() {
|
||||||
$Oem = "$env:SysPath\oem"
|
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||||
$Spp = "$env:SysPath\spp\tokens"
|
foreach ($Path in $Paths) {
|
||||||
InstallLicenseDir "$Spp"
|
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
}
|
||||||
}
|
}
|
||||||
:xrm:
|
:xrm:
|
||||||
|
|
||||||
@ -1165,6 +1185,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
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
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1175,16 +1196,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_sppissue
|
:dk_sppissue
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start %_slser% %nul%
|
||||||
set spperror=%errorlevel%
|
set spperror=%errorlevel%
|
||||||
|
|
||||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||||
%eline%
|
%eline%
|
||||||
echo sc start sppsvc [Error Code: %spperror%]
|
echo sc start %_slser% [Error Code: %spperror%]
|
||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
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
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@ -1192,7 +1213,7 @@ exit /b
|
|||||||
:dk_product
|
:dk_product
|
||||||
|
|
||||||
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
|
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=
|
set winos=
|
||||||
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
|
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
|
||||||
@ -1293,17 +1314,17 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
|||||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
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% && (
|
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||||
set "results=%results%[Likely File Infector]"
|
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 not "%results%%pupfound%"=="" (
|
||||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%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% "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
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
@ -1377,6 +1398,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 %%#==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 %%#==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 %%#==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 %%#==KeyIso sc config %%# start= demand %nul%
|
||||||
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
||||||
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
||||||
@ -1441,7 +1463,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||||
|
|
||||||
@ -1506,19 +1528,22 @@ if %osedition%==0 (
|
|||||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||||
) else (
|
) 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
|
set skunotfound=1
|
||||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
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%-*.mum" (
|
||||||
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
|
||||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
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%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
@ -1588,7 +1613,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=%%#"))
|
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 (
|
if defined _sppint (
|
||||||
@ -1602,14 +1627,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%
|
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]"
|
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"
|
%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]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
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"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
@ -1619,21 +1644,22 @@ set showfix=1
|
|||||||
|
|
||||||
|
|
||||||
set tokenstore=
|
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"
|
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% 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 toerr=1
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=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
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %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
|
:: 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%
|
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% 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)';"
|
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 +1680,7 @@ set showfix=1
|
|||||||
if not defined notwinact (
|
if not defined notwinact (
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||||
@ -1669,7 +1695,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
|
set error=1
|
||||||
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
||||||
)
|
)
|
||||||
@ -1708,7 +1734,7 @@ set "permerror=Error Found In SPP Registries"
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
if not defined permerror (
|
if not defined permerror (
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
@ -1804,8 +1830,10 @@ $wpaKey.Close()
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else if exist %ps% (
|
||||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
|
) else if not exist %ps% (
|
||||||
|
echo %~3
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1813,8 +1841,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
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'
|
%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
|
exit /b
|
||||||
|
|
||||||
@ -1829,7 +1859,8 @@ if defined fixes (
|
|||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +125,8 @@ set "nul="
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -202,10 +204,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
|
|||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 6001 (
|
||||||
%nceline%
|
%nceline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
echo MAS only supports 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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -257,16 +276,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -296,7 +317,13 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -378,7 +405,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -468,12 +495,17 @@ echo:
|
|||||||
echo Initializing...
|
echo Initializing...
|
||||||
call :dk_chkmal
|
call :dk_chkmal
|
||||||
|
|
||||||
if not exist %SysPath%\sppsvc.exe (
|
if not exist %SysPath%\%_slexe% (
|
||||||
%eline%
|
%eline%
|
||||||
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
echo [%SysPath%\%_slexe%] file is missing, aborting...
|
||||||
|
echo:
|
||||||
|
if not defined results (
|
||||||
|
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
|
||||||
|
call :dk_color %Blue% "After that, restart system and try activation again."
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
)
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -522,7 +554,7 @@ call :dk_color %Blue% "Internet is required for Online %KS% Activation."
|
|||||||
|
|
||||||
echo Initiating Diagnostic Tests...
|
echo Initiating Diagnostic Tests...
|
||||||
|
|
||||||
set "_serv=sppsvc Winmgmt"
|
set "_serv=%_slser% Winmgmt"
|
||||||
|
|
||||||
:: Software Protection
|
:: Software Protection
|
||||||
:: Windows Management Instrumentation
|
:: Windows Management Instrumentation
|
||||||
@ -612,9 +644,11 @@ echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
|||||||
if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
||||||
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VLKMS*.xrm-ms" set sppks=1
|
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VLKMS*.xrm-ms" set sppks=1
|
||||||
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1
|
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1
|
||||||
|
if %winbuild% LSS 7600 if exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*KMS*.xrm-ms" set sppks=1
|
||||||
|
if %winbuild% LSS 7600 if exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1
|
||||||
|
|
||||||
if defined skunotfound (
|
if defined skunotfound (
|
||||||
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
call :dk_color %Red% "Required license files not found."
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
@ -655,6 +689,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [
|
|||||||
)
|
)
|
||||||
|
|
||||||
if defined key (
|
if defined key (
|
||||||
|
set generickey=1
|
||||||
call :dk_inskey "[%key%]"
|
call :dk_inskey "[%key%]"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -664,7 +699,7 @@ call :dk_inskey "[%key%]"
|
|||||||
|
|
||||||
if not %_actoff%==1 goto :ks_activate
|
if not %_actoff%==1 goto :ks_activate
|
||||||
|
|
||||||
call :ks_setspp
|
call :oh_setspp
|
||||||
|
|
||||||
:: Check ohook install
|
:: Check ohook install
|
||||||
|
|
||||||
@ -709,7 +744,7 @@ set ohub=1
|
|||||||
|
|
||||||
:: Check supported office versions
|
:: Check supported office versions
|
||||||
|
|
||||||
call :ks_getpath
|
call :oh_getpath
|
||||||
|
|
||||||
set o16uwp=
|
set o16uwp=
|
||||||
set o16uwp_path=
|
set o16uwp_path=
|
||||||
@ -749,7 +784,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]"
|
|||||||
|
|
||||||
if defined ohub (
|
if defined ohub (
|
||||||
echo:
|
echo:
|
||||||
echo You have only Office dashboard app installed, you need to install full Office version.
|
echo You only have the Office Dashboard app installed. You need to install the full version of Office.
|
||||||
)
|
)
|
||||||
call :dk_color %Blue% "Download and install Office from below URL and try again."
|
call :dk_color %Blue% "Download and install Office from below URL and try again."
|
||||||
set fixes=%fixes% %mas%genuine-installation-media
|
set fixes=%fixes% %mas%genuine-installation-media
|
||||||
@ -888,9 +923,9 @@ call :ks_process
|
|||||||
|
|
||||||
:ks_startmsi
|
:ks_startmsi
|
||||||
|
|
||||||
if defined o14msi call :ks_setspp 14
|
if defined o14msi call :oh_setspp 14
|
||||||
if defined o14msi call :ks_processmsi 14 %o14msi_reg%
|
if defined o14msi call :ks_processmsi 14 %o14msi_reg%
|
||||||
call :ks_setspp
|
call :oh_setspp
|
||||||
if defined o15msi call :ks_processmsi 15 %o15msi_reg%
|
if defined o15msi call :ks_processmsi 15 %o15msi_reg%
|
||||||
if defined o16msi call :ks_processmsi 16 %o16msi_reg%
|
if defined o16msi call :ks_processmsi 16 %o16msi_reg%
|
||||||
|
|
||||||
@ -906,7 +941,7 @@ call :oh_licrefresh
|
|||||||
:ks_activate
|
:ks_activate
|
||||||
|
|
||||||
:: Opt out of sending KMSclient activation data to Microsoft
|
:: Opt out of sending KMSclient activation data to Microsoft
|
||||||
:: https://learn.microsoft.com/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform
|
:: https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform
|
||||||
|
|
||||||
if %winbuild% GEQ 9600 (
|
if %winbuild% GEQ 9600 (
|
||||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v NoGenTicket /t REG_DWORD /d 1 /f %nul%
|
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v NoGenTicket /t REG_DWORD /d 1 /f %nul%
|
||||||
@ -974,7 +1009,7 @@ echo Cleared %KS% Server from the registry.
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:: https://learn.microsoft.com/azure/virtual-desktop/windows-10-multisession-faq
|
:: https://learn.microsoft.com/en-us/azure/virtual-desktop/windows-10-multisession-faq
|
||||||
|
|
||||||
if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# (
|
if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# (
|
||||||
call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
|
call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
|
||||||
@ -1029,12 +1064,12 @@ set _prids=
|
|||||||
set _config=
|
set _config=
|
||||||
set _version=
|
set _version=
|
||||||
set _License=
|
set _License=
|
||||||
set _oBranding=
|
set _oMSI=
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:ks_getpath
|
:oh_getpath
|
||||||
|
|
||||||
set o16c2r=
|
set o16c2r=
|
||||||
set o15c2r=
|
set o15c2r=
|
||||||
@ -1050,12 +1085,12 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %
|
|||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun)
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1121,16 +1156,19 @@ exit /b
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:ks_setspp
|
:oh_setspp
|
||||||
|
|
||||||
|
set isOspp=
|
||||||
if %winbuild% GEQ 9200 (
|
if %winbuild% GEQ 9200 (
|
||||||
set spp=SoftwareLicensingProduct
|
set spp=SoftwareLicensingProduct
|
||||||
set sps=SoftwareLicensingService
|
set sps=SoftwareLicensingService
|
||||||
) else (
|
) else (
|
||||||
|
set isOspp=1
|
||||||
set spp=OfficeSoftwareProtectionProduct
|
set spp=OfficeSoftwareProtectionProduct
|
||||||
set sps=OfficeSoftwareProtectionService
|
set sps=OfficeSoftwareProtectionService
|
||||||
)
|
)
|
||||||
if "%1"=="14" (
|
if "%1"=="14" (
|
||||||
|
set isOspp=1
|
||||||
set spp=OfficeSoftwareProtectionProduct
|
set spp=OfficeSoftwareProtectionProduct
|
||||||
set sps=OfficeSoftwareProtectionService
|
set sps=OfficeSoftwareProtectionService
|
||||||
)
|
)
|
||||||
@ -1143,7 +1181,7 @@ exit /b
|
|||||||
for %%# in (%_oIds%) do (
|
for %%# in (%_oIds%) do (
|
||||||
|
|
||||||
set skipprocess=
|
set skipprocess=
|
||||||
if %_NoEditionChange%==1 if not defined _oBranding (
|
if %_NoEditionChange%==1 if not defined _oMSI (
|
||||||
set foundprod=
|
set foundprod=
|
||||||
call :ksdata chkprod %%#
|
call :ksdata chkprod %%#
|
||||||
if not defined foundprod (
|
if not defined foundprod (
|
||||||
@ -1184,21 +1222,26 @@ call :ksdata getinfo !_prod!
|
|||||||
if defined _altoffid (
|
if defined _altoffid (
|
||||||
set _License=!_altoffid!
|
set _License=!_altoffid!
|
||||||
echo Converting Retail To Volume [!_prod! To !_altoffid!]
|
echo Converting Retail To Volume [!_prod! To !_altoffid!]
|
||||||
|
echo %%# | find /i "O365" %nul% && (
|
||||||
|
if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.")
|
||||||
|
if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.")
|
||||||
|
)
|
||||||
set _prod=!_altoffid!
|
set _prod=!_altoffid!
|
||||||
call :ks_osppready
|
call :ks_osppready
|
||||||
)
|
)
|
||||||
|
|
||||||
if not "!key!"=="" (
|
if not "!key!"=="" (
|
||||||
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
||||||
|
set generickey=1
|
||||||
call :dk_inskey "[!key!] [!_prod!]"
|
call :dk_inskey "[!key!] [!_prod!]"
|
||||||
) else (
|
) else (
|
||||||
if not defined _oBranding (
|
if not defined _oMSI (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
|
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
|
||||||
call :dk_color %Blue% "Make sure you are using Latest MAS script."
|
call :dk_color %Blue% "Make sure you are using Latest MAS script."
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]"
|
call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]"
|
||||||
call :dk_color %Blue% "Uninstall this and Install C2R or MSI VL version of Office."
|
call :dk_color %Blue% "Use Ohook option to activate it. To activate with %KS%, you need to install Volume version of Office."
|
||||||
)
|
)
|
||||||
set fixes=%fixes% %mas%genuine-installation-media
|
set fixes=%fixes% %mas%genuine-installation-media
|
||||||
call :dk_color %_Yellow% "%mas%genuine-installation-media"
|
call :dk_color %_Yellow% "%mas%genuine-installation-media"
|
||||||
@ -1215,6 +1258,7 @@ exit /b
|
|||||||
:: Process Office MSI Version
|
:: Process Office MSI Version
|
||||||
|
|
||||||
call :ks_reset
|
call :ks_reset
|
||||||
|
set _oMSI=1
|
||||||
|
|
||||||
if "%1"=="14" (
|
if "%1"=="14" (
|
||||||
call :dk_actids 59a52881-a989-479d-af46-f275c6370663
|
call :dk_actids 59a52881-a989-479d-af46-f275c6370663
|
||||||
@ -1231,25 +1275,11 @@ echo "%2" | find /i "Wow6432Node" %nul1% && set _oArch=x86
|
|||||||
if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64
|
if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64
|
||||||
if "%osarch%"=="x86" set _oArch=x86
|
if "%osarch%"=="x86" set _oArch=x86
|
||||||
|
|
||||||
set "_common=%CommonProgramFiles%"
|
call :msiofficedata %2
|
||||||
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
|
|
||||||
set "_common2=%CommonProgramFiles(x86)%"
|
|
||||||
|
|
||||||
for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f"
|
|
||||||
if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f"
|
|
||||||
|
|
||||||
call :ksdata getmsiprod %2
|
|
||||||
call :msiofficedata %2 getmsiret
|
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Processing Office... [MSI ^| %_version% ^| %_oArch%]
|
echo Processing Office... [MSI ^| %_version% ^| %_oArch%]
|
||||||
|
|
||||||
if not defined _oBranding (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
if not defined _oIds (
|
if not defined _oIds (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]"
|
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]"
|
||||||
@ -1314,7 +1344,7 @@ exit /b
|
|||||||
:oh_clearblock
|
:oh_clearblock
|
||||||
|
|
||||||
:: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing
|
:: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing
|
||||||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||||
|
|
||||||
set _sidlist=
|
set _sidlist=
|
||||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||||
@ -1410,12 +1440,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
|
|||||||
)
|
)
|
||||||
|
|
||||||
:: Clear device-based-licensing
|
:: Clear device-based-licensing
|
||||||
:: https://learn.microsoft.com/deployoffice/device-based-licensing
|
:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing
|
||||||
|
|
||||||
for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
|
for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
|
||||||
|
|
||||||
:: Remove OEM registry key
|
:: Remove OEM registry key
|
||||||
:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
|
:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
|
||||||
|
|
||||||
for %%# in (15 16) do (
|
for %%# in (15 16) do (
|
||||||
reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul%
|
reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul%
|
||||||
@ -1657,6 +1687,11 @@ set "nul=>nul 2>&1"
|
|||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
set psc=powershell.exe -nop -c
|
set psc=powershell.exe -nop -c
|
||||||
|
|
||||||
|
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 run_once=
|
set run_once=
|
||||||
set t_name=Renewal Task
|
set t_name=Renewal Task
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "\Activation-Run_Once" >nul && (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "\Activation-Run_Once" >nul && (
|
||||||
@ -1668,6 +1703,7 @@ set _wmic=0
|
|||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
||||||
)
|
)
|
||||||
|
if %winbuild% LSS 9200 set _wmic=1
|
||||||
|
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
|
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
|
||||||
@ -1720,7 +1756,7 @@ call :_taskclear-cache
|
|||||||
:: Check WMI and sppsvc Errors
|
:: Check WMI and sppsvc Errors
|
||||||
|
|
||||||
set applist=
|
set applist=
|
||||||
net start sppsvc /y %nul%
|
net start %_slser% /y %nul%
|
||||||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %slp% where (ApplicationID='%_wApp%') get ID /VALUE" 2^>nul')"
|
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %slp% where (ApplicationID='%_wApp%') get ID /VALUE" 2^>nul')"
|
||||||
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %slp% WHERE ApplicationID=''%_wApp%''').Get()).ID ^| %% {echo ('ID='+$_)}" 2^>nul')"
|
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %slp% WHERE ApplicationID=''%_wApp%''').Get()).ID ^| %% {echo ('ID='+$_)}" 2^>nul')"
|
||||||
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
|
%chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a"))
|
||||||
@ -2022,12 +2058,20 @@ exit /b
|
|||||||
:_taskclear-cache
|
:_taskclear-cache
|
||||||
|
|
||||||
set w=
|
set w=
|
||||||
for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do (
|
for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do (
|
||||||
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%
|
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%
|
||||||
)
|
)
|
||||||
|
|
||||||
set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"
|
set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"
|
||||||
|
|
||||||
|
if %winbuild% LSS 7600 (
|
||||||
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && (
|
||||||
|
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if not defined SPPk (
|
||||||
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
|
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
|
||||||
|
)
|
||||||
|
|
||||||
set "slp=SoftwareLicensingProduct"
|
set "slp=SoftwareLicensingProduct"
|
||||||
set "ospp=OfficeSoftwareProtectionProduct"
|
set "ospp=OfficeSoftwareProtectionProduct"
|
||||||
@ -2143,10 +2187,11 @@ for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G"
|
|||||||
set "_temp=%SystemRoot%\Temp\%Random%%randguid%"
|
set "_temp=%SystemRoot%\Temp\%Random%%randguid%"
|
||||||
|
|
||||||
set nil=
|
set nil=
|
||||||
|
if %winbuild% LSS 7600 (set _vista=_vista)
|
||||||
if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul%
|
if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul%
|
||||||
md "%_temp%\" %nul%
|
md "%_temp%\" %nul%
|
||||||
call :ks_RenExport renewal "%_temp%\Renewal.xml" Unicode
|
call :ks_RenExport renewal%_vista% "%_temp%\Renewal.xml" Unicode
|
||||||
if not defined _int (call :ks_RenExport run_once "%_temp%\Run_Once.xml" Unicode)
|
if not defined _int (call :ks_RenExport run_once%_vista% "%_temp%\Run_Once.xml" Unicode)
|
||||||
s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Renewal" /ru "SYS%nil%TEM" /xml "%_temp%\Renewal.xml" %nul%
|
s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Renewal" /ru "SYS%nil%TEM" /xml "%_temp%\Renewal.xml" %nul%
|
||||||
if not defined _int (s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Run_Once" /ru "SYS%nil%TEM" /xml "%_temp%\Run_Once.xml" %nul%)
|
if not defined _int (s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Run_Once" /ru "SYS%nil%TEM" /xml "%_temp%\Run_Once.xml" %nul%)
|
||||||
if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul%
|
if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul%
|
||||||
@ -2335,16 +2380,137 @@ exit /b
|
|||||||
</Task>
|
</Task>
|
||||||
:run_once:
|
:run_once:
|
||||||
|
|
||||||
|
:renewal_vista:
|
||||||
|
<?xml version="1.0" encoding="UTF-16"?>
|
||||||
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
||||||
|
<RegistrationInfo>
|
||||||
|
<Date>1999-01-01T12:00:00.34375</Date>
|
||||||
|
<Author>WindowsAddict</Author>
|
||||||
|
<Description>Online K-M-S Activation-Renewal - Weekly Task</Description>
|
||||||
|
</RegistrationInfo>
|
||||||
|
<Triggers>
|
||||||
|
<CalendarTrigger>
|
||||||
|
<StartBoundary>1999-01-01T12:00:00.34375</StartBoundary>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<ScheduleByWeek>
|
||||||
|
<DaysOfWeek>
|
||||||
|
<Sunday />
|
||||||
|
</DaysOfWeek>
|
||||||
|
<WeeksInterval>1</WeeksInterval>
|
||||||
|
</ScheduleByWeek>
|
||||||
|
</CalendarTrigger>
|
||||||
|
</Triggers>
|
||||||
|
<Principals>
|
||||||
|
<Principal id="Author">
|
||||||
|
<UserId>S-1-5-18</UserId>
|
||||||
|
<RunLevel>HighestAvailable</RunLevel>
|
||||||
|
</Principal>
|
||||||
|
</Principals>
|
||||||
|
<Settings>
|
||||||
|
<IdleSettings>
|
||||||
|
<Duration>PT10M</Duration>
|
||||||
|
<WaitTimeout>PT1H</WaitTimeout>
|
||||||
|
<StopOnIdleEnd>true</StopOnIdleEnd>
|
||||||
|
<RestartOnIdle>false</RestartOnIdle>
|
||||||
|
</IdleSettings>
|
||||||
|
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
||||||
|
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
||||||
|
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
|
||||||
|
<AllowHardTerminate>true</AllowHardTerminate>
|
||||||
|
<StartWhenAvailable>true</StartWhenAvailable>
|
||||||
|
<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
|
||||||
|
<NetworkSettings />
|
||||||
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<Hidden>false</Hidden>
|
||||||
|
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
||||||
|
<WakeToRun>false</WakeToRun>
|
||||||
|
<ExecutionTimeLimit>PT10M</ExecutionTimeLimit>
|
||||||
|
<Priority>7</Priority>
|
||||||
|
<RestartOnFailure>
|
||||||
|
<Interval>PT5M</Interval>
|
||||||
|
<Count>3</Count>
|
||||||
|
</RestartOnFailure>
|
||||||
|
</Settings>
|
||||||
|
<Actions Context="Author">
|
||||||
|
<Exec>
|
||||||
|
<Command>%ProgramFiles%\Activation-Renewal\Activation_task.cmd</Command>
|
||||||
|
<Arguments>Task</Arguments>
|
||||||
|
</Exec>
|
||||||
|
</Actions>
|
||||||
|
</Task>
|
||||||
|
:renewal_vista:
|
||||||
|
|
||||||
|
:run_once_vista:
|
||||||
|
<?xml version="1.0" encoding="UTF-16"?>
|
||||||
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
||||||
|
<RegistrationInfo>
|
||||||
|
<Date>1999-01-01T12:00:00.34375</Date>
|
||||||
|
<Author>WindowsAddict</Author>
|
||||||
|
<Description>Online K-M-S Activation Run Once - Run and Delete itself on first Internet Contact</Description>
|
||||||
|
</RegistrationInfo>
|
||||||
|
<Triggers>
|
||||||
|
<LogonTrigger>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
</LogonTrigger>
|
||||||
|
</Triggers>
|
||||||
|
<Principals>
|
||||||
|
<Principal id="Author">
|
||||||
|
<UserId>S-1-5-18</UserId>
|
||||||
|
<RunLevel>HighestAvailable</RunLevel>
|
||||||
|
</Principal>
|
||||||
|
</Principals>
|
||||||
|
<Settings>
|
||||||
|
<IdleSettings>
|
||||||
|
<Duration>PT10M</Duration>
|
||||||
|
<WaitTimeout>PT1H</WaitTimeout>
|
||||||
|
<StopOnIdleEnd>true</StopOnIdleEnd>
|
||||||
|
<RestartOnIdle>false</RestartOnIdle>
|
||||||
|
</IdleSettings>
|
||||||
|
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
||||||
|
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
||||||
|
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
|
||||||
|
<AllowHardTerminate>true</AllowHardTerminate>
|
||||||
|
<StartWhenAvailable>true</StartWhenAvailable>
|
||||||
|
<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
|
||||||
|
<NetworkSettings />
|
||||||
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<Hidden>false</Hidden>
|
||||||
|
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
||||||
|
<WakeToRun>false</WakeToRun>
|
||||||
|
<ExecutionTimeLimit>PT10M</ExecutionTimeLimit>
|
||||||
|
<Priority>7</Priority>
|
||||||
|
<RestartOnFailure>
|
||||||
|
<Interval>PT5M</Interval>
|
||||||
|
<Count>3</Count>
|
||||||
|
</RestartOnFailure>
|
||||||
|
</Settings>
|
||||||
|
<Actions Context="Author">
|
||||||
|
<Exec>
|
||||||
|
<Command>%ProgramFiles%\Activation-Renewal\Activation_task.cmd</Command>
|
||||||
|
<Arguments>Task</Arguments>
|
||||||
|
</Exec>
|
||||||
|
</Actions>
|
||||||
|
</Task>
|
||||||
|
:run_once_vista:
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Set variables
|
:: Set variables
|
||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
@ -2484,11 +2650,12 @@ set keyerror=%errorlevel%
|
|||||||
cmd /c exit /b %keyerror%
|
cmd /c exit /b %keyerror%
|
||||||
if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]"
|
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 %keyerror% EQU 0 (
|
||||||
if %sps%==SoftwareLicensingService call :dk_refresh
|
if %sps%==SoftwareLicensingService call :dk_refresh
|
||||||
echo Installing Generic Product Key %~1 [Successful]
|
echo %keyecho% %~1 [Successful]
|
||||||
) else (
|
) 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 not defined error (
|
||||||
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
|
||||||
call :dk_color %Blue% "%_fixmsg%"
|
call :dk_color %Blue% "%_fixmsg%"
|
||||||
@ -2497,6 +2664,7 @@ set showfix=1
|
|||||||
set error=1
|
set error=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set generickey=
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Windows installed key channel
|
:: Get Windows installed key channel
|
||||||
@ -2521,9 +2689,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
|
|||||||
|
|
||||||
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
|
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
|
||||||
set len=0
|
set len=0
|
||||||
echo:!allapps!> %SystemRoot%\Temp\chklen
|
echo:!allapps!> "!_ttemp!\chklen"
|
||||||
for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA)
|
for %%A in ("!_ttemp!\chklen") do (set len=%%~zA)
|
||||||
del %SystemRoot%\Temp\chklen %nul%
|
del "!_ttemp!\chklen" %nul%
|
||||||
|
|
||||||
if !len! GTR 6000 (
|
if !len! GTR 6000 (
|
||||||
%eline%
|
%eline%
|
||||||
@ -2548,6 +2716,8 @@ exit /b
|
|||||||
|
|
||||||
:dk_reeval
|
: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
|
:: 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"
|
set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState"
|
||||||
@ -2575,13 +2745,13 @@ function InstallLicenseArr($Str) {
|
|||||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||||
}
|
}
|
||||||
function InstallLicenseDir($Loc) {
|
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() {
|
function ReinstallLicenses() {
|
||||||
$Oem = "$env:SysPath\oem"
|
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||||
$Spp = "$env:SysPath\spp\tokens"
|
foreach ($Path in $Paths) {
|
||||||
InstallLicenseDir "$Spp"
|
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
}
|
||||||
}
|
}
|
||||||
:xrm:
|
:xrm:
|
||||||
|
|
||||||
@ -2589,6 +2759,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
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
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -2599,16 +2770,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_sppissue
|
:dk_sppissue
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start %_slser% %nul%
|
||||||
set spperror=%errorlevel%
|
set spperror=%errorlevel%
|
||||||
|
|
||||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||||
%eline%
|
%eline%
|
||||||
echo sc start sppsvc [Error Code: %spperror%]
|
echo sc start %_slser% [Error Code: %spperror%]
|
||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
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
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@ -2616,7 +2787,7 @@ exit /b
|
|||||||
:dk_product
|
:dk_product
|
||||||
|
|
||||||
set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3);
|
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=
|
set winos=
|
||||||
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
|
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s)
|
||||||
@ -2717,17 +2888,17 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
|||||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
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% && (
|
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||||
set "results=%results%[Likely File Infector]"
|
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 not "%results%%pupfound%"=="" (
|
||||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%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% "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
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
@ -2801,6 +2972,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 %%#==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 %%#==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 %%#==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 %%#==KeyIso sc config %%# start= demand %nul%
|
||||||
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
if /i %%#==LicenseManager sc config %%# start= demand %nul%
|
||||||
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
if /i %%#==Winmgmt sc config %%# start= auto %nul%
|
||||||
@ -2865,7 +3037,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||||
|
|
||||||
@ -2930,19 +3102,22 @@ if %osedition%==0 (
|
|||||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||||
) else (
|
) 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
|
set skunotfound=1
|
||||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
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%-*.mum" (
|
||||||
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" (
|
||||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
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%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
@ -3012,7 +3187,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=%%#"))
|
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 (
|
if defined _sppint (
|
||||||
@ -3026,14 +3201,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%
|
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]"
|
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"
|
%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]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
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"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
@ -3043,21 +3218,22 @@ set showfix=1
|
|||||||
|
|
||||||
|
|
||||||
set tokenstore=
|
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"
|
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% 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 toerr=1
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=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
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %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
|
:: 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%
|
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% 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)';"
|
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)';"
|
||||||
@ -3078,7 +3254,7 @@ set showfix=1
|
|||||||
if not defined notwinact (
|
if not defined notwinact (
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||||
@ -3093,7 +3269,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
|
set error=1
|
||||||
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
|
||||||
)
|
)
|
||||||
@ -3132,7 +3308,7 @@ set "permerror=Error Found In SPP Registries"
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
if not defined permerror (
|
if not defined permerror (
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
@ -3228,8 +3404,10 @@ $wpaKey.Close()
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else if exist %ps% (
|
||||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
|
) else if not exist %ps% (
|
||||||
|
echo %~3
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -3237,8 +3415,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
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'
|
%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
|
exit /b
|
||||||
|
|
||||||
@ -3253,7 +3433,8 @@ if defined fixes (
|
|||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
@ -3275,47 +3456,30 @@ exit /b
|
|||||||
:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only)
|
:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only)
|
||||||
:: Separator = "_"
|
:: Separator = "_"
|
||||||
|
|
||||||
:: EditionID Notes:
|
|
||||||
:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing.
|
|
||||||
|
|
||||||
:: In Office 2010, the situation is a bit more complicated.
|
|
||||||
:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types.
|
|
||||||
:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID.
|
|
||||||
:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID.
|
|
||||||
|
|
||||||
:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage.
|
|
||||||
|
|
||||||
:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three.
|
|
||||||
:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case.
|
|
||||||
|
|
||||||
:msiofficedata
|
:msiofficedata
|
||||||
|
|
||||||
for %%# in (
|
for %%# in (
|
||||||
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR
|
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR
|
||||||
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR
|
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR
|
||||||
14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL
|
14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL
|
||||||
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR
|
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR]
|
||||||
14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL
|
14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL
|
||||||
14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR
|
14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR
|
||||||
14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL
|
14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL
|
||||||
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR]
|
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR]
|
||||||
14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR
|
14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR
|
||||||
14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR]
|
14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR]
|
||||||
14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR
|
|
||||||
14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR
|
|
||||||
14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR
|
|
||||||
14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR
|
|
||||||
14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR
|
14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR
|
||||||
14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL
|
14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL
|
||||||
14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR
|
14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR
|
||||||
14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL
|
14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL
|
||||||
14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception
|
14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception
|
||||||
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR
|
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR]
|
||||||
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL
|
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL
|
||||||
14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR
|
14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR
|
||||||
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL
|
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL
|
||||||
14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR]
|
14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR]
|
||||||
14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR
|
14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR]
|
||||||
14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL
|
14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL
|
||||||
14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR]
|
14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR]
|
||||||
14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR]
|
14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR]
|
||||||
@ -3336,7 +3500,7 @@ for %%# in (
|
|||||||
14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR
|
14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR
|
||||||
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception
|
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception
|
||||||
14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception
|
14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception
|
||||||
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR
|
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR]
|
||||||
14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL
|
14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL
|
||||||
:: Office 2013
|
:: Office 2013
|
||||||
15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail
|
15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail
|
||||||
@ -3450,15 +3614,11 @@ for %%# in (
|
|||||||
) do (
|
) do (
|
||||||
for /f "tokens=1-5 delims=_" %%A in ("%%#") do (
|
for /f "tokens=1-5 delims=_" %%A in ("%%#") do (
|
||||||
|
|
||||||
set getIds=1
|
|
||||||
if "%oVer%"=="%%A" (
|
if "%oVer%"=="%%A" (
|
||||||
if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=)
|
|
||||||
|
|
||||||
if defined getIds (
|
|
||||||
reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && (
|
reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && (
|
||||||
reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && (
|
reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && (
|
||||||
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
|
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
|
||||||
)
|
if /i 003D==%%C set SingleImage=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -3602,7 +3762,22 @@ a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__17_Server
|
|||||||
cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX__18_ServerHPC
|
cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX__18_ServerHPC
|
||||||
a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__29_ServerWebCore
|
a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__29_ServerWebCore
|
||||||
f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K__56_ServerEmbeddedSolution
|
f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K__56_ServerEmbeddedSolution
|
||||||
::========================================================================================================================================
|
:: Windows Vista
|
||||||
|
cfd8ff08-c0d7-452b-9f60-ef5c70c32094_VKK3X-68KWM-X2YGT-QR4M6-4B%f%WMV___4_Enterprise
|
||||||
|
4f3d1606-3fea-4c01-be3c-8d671c401e3b_YFKBB-PQJJV-G996G-VWGXY-2V%f%3X8___6_Business
|
||||||
|
2c682dc2-8b68-4f63-a165-ae291d4cf138_HMBQG-8H2RH-C77VX-27R82-VM%f%QBT__16_BusinessN
|
||||||
|
d4f54950-26f2-4fb4-ba21-ffab16afcade_VTC42-BM838-43QHV-84HX6-XJ%f%XKV__27_EnterpriseN
|
||||||
|
:: Windows Server 2008
|
||||||
|
ad2542d4-9154-4c6d-8a44-30f11ee96989_TM24T-X9RMF-VWXK6-X8JC9-BF%f%GM2___7_ServerStandard
|
||||||
|
68b6e220-cf09-466b-92d3-45cd964b9509_7M67G-PC374-GR742-YH8V4-TC%f%BY3___8_ServerDatacenter
|
||||||
|
c1af4d90-d1bc-44ca-85d4-003ba33db3b9_YQGMW-MPWTJ-34KDK-48M3W-X4%f%Q6V__10_ServerEnterprise
|
||||||
|
01ef176b-3e0d-422a-b4f8-4ea880035e8f_4DWFP-JF3DJ-B7DTH-78FJB-PD%f%RHK__15_ServerEnterpriseIA64
|
||||||
|
ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b_WYR28-R7TFJ-3X2YQ-YCY4H-M2%f%49D__17_ServerWeb
|
||||||
|
7afb1156-2c1d-40fc-b260-aab7442b62fe_RCTX3-KWVHP-BR6TB-RB6DM-6X%f%7HP__18_ServerComputeCluster
|
||||||
|
2401e3d0-c50a-4b58-87b2-7e794b7d2607_W7VD6-7JFBR-RX26B-YKQ3Y-6F%f%FFJ__36_ServerStandardV
|
||||||
|
fd09ef77-5647-4eff-809c-af2b64659a45_22XQ2-VRXRG-P8D42-K34TD-G3%f%QQC__37_ServerDatacenterV
|
||||||
|
8198490a-add0-47b2-b3ba-316b12d647b4_39BXF-X8Q23-P2WWT-38T2F-G3%f%FPG__38_ServerEnterpriseV
|
||||||
|
::=======================================================================================================================================
|
||||||
:: Office 2010
|
:: Office 2010
|
||||||
8ce7e872-188c-4b98-9d90-f8f90b7aad02_V7Y44-9T38C-R2VJK-666HK-T7%f%DDX__14_AccessVL
|
8ce7e872-188c-4b98-9d90-f8f90b7aad02_V7Y44-9T38C-R2VJK-666HK-T7%f%DDX__14_AccessVL
|
||||||
cee5d470-6e3b-4fcc-8c2b-d17428568a9f_H62QG-HXVKF-PP4HP-66KMR-CW%f%9BM__14_ExcelVL
|
cee5d470-6e3b-4fcc-8c2b-d17428568a9f_H62QG-HXVKF-PP4HP-66KMR-CW%f%9BM__14_ExcelVL
|
||||||
@ -3649,7 +3824,7 @@ d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3_6Q7VD-NX8JD-WJ2VH-88V73-4G%f%BJ7__15_WordVo
|
|||||||
67c0fc0c-deba-401b-bf8b-9c8ad8395804_GNH9Y-D2J4T-FJHGG-QRVH7-QP%f%FDW__16_AccessVolume_-AccessRetail-
|
67c0fc0c-deba-401b-bf8b-9c8ad8395804_GNH9Y-D2J4T-FJHGG-QRVH7-QP%f%FDW__16_AccessVolume_-AccessRetail-
|
||||||
c3e65d36-141f-4d2f-a303-a842ee756a29_9C2PK-NWTVB-JMPW8-BFT28-7F%f%TBF__16_ExcelVolume_-ExcelRetail-
|
c3e65d36-141f-4d2f-a303-a842ee756a29_9C2PK-NWTVB-JMPW8-BFT28-7F%f%TBF__16_ExcelVolume_-ExcelRetail-
|
||||||
e914ea6e-a5fa-4439-a394-a9bb3293ca09_DMTCJ-KNRKX-26982-JYCKT-P7%f%KB6__16_MondoRetail
|
e914ea6e-a5fa-4439-a394-a9bb3293ca09_DMTCJ-KNRKX-26982-JYCKT-P7%f%KB6__16_MondoRetail
|
||||||
9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail-
|
9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365AppsBasicRetail-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail-
|
||||||
436366de-5579-4f24-96db-3893e4400030_XYNTG-R96FY-369HX-YFPHY-F9%f%CPM__16_OneNoteFreeRetail_[Bypass]
|
436366de-5579-4f24-96db-3893e4400030_XYNTG-R96FY-369HX-YFPHY-F9%f%CPM__16_OneNoteFreeRetail_[Bypass]
|
||||||
d8cace59-33d2-4ac7-9b1b-9b72339c51c8_DR92N-9HTF2-97XKM-XW2WJ-XW%f%3J6__16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail-
|
d8cace59-33d2-4ac7-9b1b-9b72339c51c8_DR92N-9HTF2-97XKM-XW2WJ-XW%f%3J6__16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail-
|
||||||
ec9d9265-9d1e-4ed0-838a-cdc20f2551a1_R69KK-NTPKF-7M3Q4-QYBHW-6M%f%T9B__16_OutlookVolume_-OutlookRetail-
|
ec9d9265-9d1e-4ed0-838a-cdc20f2551a1_R69KK-NTPKF-7M3Q4-QYBHW-6M%f%T9B__16_OutlookVolume_-OutlookRetail-
|
||||||
@ -3734,7 +3909,7 @@ if /i "%2"=="%%D" (
|
|||||||
set key=%%B
|
set key=%%B
|
||||||
set _actid=%%A
|
set _actid=%%A
|
||||||
set _allactid=!_allactid! %%A
|
set _allactid=!_allactid! %%A
|
||||||
) else if not defined _oBranding if %_NoEditionChange%==0 (
|
) else if not defined _oMSI if %_NoEditionChange%==0 (
|
||||||
echo: %%E | find /i "-%2-" %nul% && (
|
echo: %%E | find /i "-%2-" %nul% && (
|
||||||
set key=%%B
|
set key=%%B
|
||||||
set _altoffid=%%D
|
set _altoffid=%%D
|
||||||
@ -3744,21 +3919,6 @@ set _allactid=!_allactid! %%A
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if %1==getmsiprod if "%oVer%"=="%%C" (
|
|
||||||
for /f "tokens=*" %%x in ('findstr /i /c:"%%A" "%_oBranding%"') do set "prodId=%%x"
|
|
||||||
set prodId=!prodId:"/>=!
|
|
||||||
set prodId=!prodId:~-4!
|
|
||||||
if "%oVer%"=="14" (
|
|
||||||
REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml
|
|
||||||
echo %%D | find /i "Visio" %nul% && set prodId=0057
|
|
||||||
)
|
|
||||||
reg query "%2\Registration\{%%A}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +60,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -134,9 +136,9 @@ goto dk_done
|
|||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 7600 (
|
||||||
%nceline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -188,16 +190,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -227,7 +231,13 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -309,7 +319,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -323,15 +333,6 @@ echo:
|
|||||||
echo Initializing...
|
echo Initializing...
|
||||||
echo:
|
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
|
set spp=SoftwareLicensingProduct
|
||||||
@ -365,8 +366,7 @@ if %osedition%==0 (
|
|||||||
%eline%
|
%eline%
|
||||||
echo Failed to detect OS Edition. Aborting...
|
echo Failed to detect OS Edition. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -415,6 +415,7 @@ _updch
|
|||||||
_lang
|
_lang
|
||||||
_clversion
|
_clversion
|
||||||
_version
|
_version
|
||||||
|
_AudienceData
|
||||||
_oIds
|
_oIds
|
||||||
_c2rXml
|
_c2rXml
|
||||||
_c2rExe
|
_c2rExe
|
||||||
@ -802,8 +803,40 @@ set errorcode=%errorlevel%
|
|||||||
timeout /t 10 %nul%
|
timeout /t 10 %nul%
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
|
set suggestchannel=
|
||||||
|
|
||||||
if %errorcode% EQU 0 (
|
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 (
|
) else (
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -980,6 +1013,12 @@ echo Installed Office editions: %_oIds%
|
|||||||
echo Unsupported Office edition is installed on your Windows build version %winbuild%.
|
echo Unsupported Office edition is installed on your Windows build version %winbuild%.
|
||||||
goto :oe_goback
|
goto :oe_goback
|
||||||
)
|
)
|
||||||
|
if defined ltscfound (
|
||||||
|
%eline%
|
||||||
|
echo Installed Office update channel: %ltsc19%%ltsc21%%ltsc24%
|
||||||
|
echo Unsupported Office update channel is installed on your Windows build version %winbuild%.
|
||||||
|
goto :oe_goback
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
::===============
|
::===============
|
||||||
@ -988,49 +1027,52 @@ set inpt=
|
|||||||
set counter=0
|
set counter=0
|
||||||
set verified=0
|
set verified=0
|
||||||
set targetFFN=
|
set targetFFN=
|
||||||
|
set bypassFFN=
|
||||||
set targetchannel=
|
set targetchannel=
|
||||||
|
|
||||||
%line%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%"
|
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%
|
%line%
|
||||||
echo:
|
echo:
|
||||||
|
|
||||||
for %%# in (
|
for %%# in (
|
||||||
"5440FD1F-7ECB-4221-8110-145EFAA6372F_Insider Fast [Beta] - Insiders::DevMain"
|
"5440fd1f-7ecb-4221-8110-145efaa6372f_Insider Fast [Beta] - Insiders::DevMain -"
|
||||||
"64256AFE-F5D9-4F86-8936-8840A6A4F5BE_Monthly Preview - Insiders::CC"
|
"64256afe-f5d9-4f86-8936-8840a6a4f5be_Monthly Preview - Insiders::CC -"
|
||||||
"492350F6-3A01-4F97-B9C0-C7C6DDF67D60_Monthly [Current] - Production::CC"
|
"492350f6-3a01-4f97-b9c0-c7c6ddf67d60_Monthly [Current] - Production::CC -"
|
||||||
"55336B82-A18D-4DD6-B5F6-9E5095C314A6_Monthly Enterprise - Production::MEC"
|
"55336b82-a18d-4dd6-b5f6-9e5095c314a6_Monthly Enterprise - Production::MEC -"
|
||||||
"B8F9B850-328D-4355-9145-C59439A0C4CF_Semi Annual Preview - Insiders::FRDC"
|
"b8f9b850-328d-4355-9145-c59439a0c4cf_Semi Annual Preview - Insiders::FRDC -"
|
||||||
"7FFBC6BF-BC32-4F92-8982-F9DD17FD3114_Semi Annual - Production::DC"
|
"7ffbc6bf-bc32-4f92-8982-f9dd17fd3114_Semi Annual - Production::DC -"
|
||||||
"EA4A4090-DE26-49D7-93C1-91BFF9E53FC3_DevMain Channel - Dogfood::DevMain"
|
"ea4a4090-de26-49d7-93c1-91bff9e53fc3_DevMain Channel - Dogfood::DevMain -"
|
||||||
"B61285DD-D9F7-41F2-9757-8F61CBA4E9C8_Microsoft Elite - Microsoft::DevMain"
|
"b61285dd-d9f7-41f2-9757-8f61cba4e9c8_Microsoft Elite - Microsoft::DevMain -"
|
||||||
"F2E724C1-748F-4B47-8FB8-8E0D210E9208_Perpetual2019 VL - Production::LTSC"
|
"f2e724c1-748f-4b47-8fb8-8e0d210e9208_Perpetual2019 VL - Production::LTSC -"
|
||||||
"1D2D2EA6-1680-4C56-AC58-A441C8C24FF9_Microsoft2019 VL - Microsoft::LTSC"
|
"1d2d2ea6-1680-4c56-ac58-a441c8c24ff9_Microsoft2019 VL - Microsoft::LTSC -"
|
||||||
"5030841D-C919-4594-8D2D-84AE4F96E58E_Perpetual2021 VL - Production::LTSC2021"
|
"5030841d-c919-4594-8d2d-84ae4f96e58e_Perpetual2021 VL - Production::LTSC2021 -"
|
||||||
"86752282-5841-4120-AC80-DB03AE6B5FDB_Microsoft2021 VL - Microsoft::LTSC2021"
|
"86752282-5841-4120-ac80-db03ae6b5fdb_Microsoft2021 VL - Microsoft::LTSC2021 -"
|
||||||
"7983BAC0-E531-40CF-BE00-FD24FE66619C_Perpetual2024 VL - Production::LTSC2024"
|
"7983bac0-e531-40cf-be00-fd24fe66619c_Perpetual2024 VL - Production::LTSC2024 -"
|
||||||
"C02D8FE6-5242-4DA8-972F-82EE55E00671_Microsoft2024 VL - Microsoft::LTSC2024"
|
"c02d8fe6-5242-4da8-972f-82ee55e00671_Microsoft2024 VL - Microsoft::LTSC2024 -"
|
||||||
) do (
|
) do (
|
||||||
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
|
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
|
||||||
|
set bypass=
|
||||||
set supported=
|
set supported=
|
||||||
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
|
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
|
||||||
if %winbuild% GEQ 10240 (
|
if %winbuild% GEQ 10240 (
|
||||||
if defined ltsc19 echo %%B | find /i "2019 VL" %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 supported=
|
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set bypass=1
|
||||||
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported=
|
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set bypass=1
|
||||||
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported=
|
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set bypass=1
|
||||||
)
|
)
|
||||||
if defined supported (
|
if defined supported (
|
||||||
set /a counter+=1
|
set /a counter+=1
|
||||||
if !counter! LSS 10 (
|
if !counter! LSS 10 (
|
||||||
echo [!counter!] %%B
|
if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
|
||||||
) else (
|
) 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 targetFFN!counter!=%%A
|
||||||
set targetchannel!counter!=%%B
|
set targetchannel!counter!=%%B
|
||||||
|
if defined bypass set bypassFFN=!bypassFFN!%%A
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1044,7 +1086,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En
|
|||||||
set /p inpt=
|
set /p inpt=
|
||||||
if "%inpt%"=="" goto :oe_changeupdchnl
|
if "%inpt%"=="" goto :oe_changeupdchnl
|
||||||
if "%inpt%"=="0" goto :oemenu
|
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)
|
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
|
||||||
set targetFFN=!targetFFN%inpt%!
|
set targetFFN=!targetFFN%inpt%!
|
||||||
set targetchannel=!targetchannel%inpt%!
|
set targetchannel=!targetchannel%inpt%!
|
||||||
@ -1061,15 +1103,133 @@ set build=
|
|||||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a)
|
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a)
|
||||||
echo "%build%" | find /i "16." %nul% || set build=
|
echo "%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
|
:: 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://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
|
:: 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:
|
||||||
echo Cleaning Office update registry keys...
|
echo Cleaning Office update registry keys...
|
||||||
echo Adding new update channel to 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 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
|
%nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
|
||||||
@ -1086,42 +1246,7 @@ echo Adding new update channel to registry keys...
|
|||||||
%nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32
|
%nul% reg delete 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
|
%nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f
|
||||||
|
|
||||||
if not defined build (
|
exit /b
|
||||||
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
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@ -1144,6 +1269,7 @@ set _oRoot=
|
|||||||
set _oArch=
|
set _oArch=
|
||||||
set _updch=
|
set _updch=
|
||||||
set _oIds=
|
set _oIds=
|
||||||
|
set _firstoId=
|
||||||
set _lang=
|
set _lang=
|
||||||
set _cfolder=
|
set _cfolder=
|
||||||
set _version=
|
set _version=
|
||||||
@ -1174,9 +1300,13 @@ for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseI
|
|||||||
if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a")
|
if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a")
|
||||||
)
|
)
|
||||||
set _oIds=%_oIds:.16=%
|
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 verchk=0
|
||||||
|
set clverchk=0
|
||||||
for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a"
|
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"
|
if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml"
|
||||||
|
|
||||||
@ -1192,16 +1322,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
|
|||||||
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
|
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
|
||||||
)
|
)
|
||||||
|
|
||||||
set "audidata4=%_AudienceData:~-4%"
|
:: Check LTSC version files
|
||||||
|
|
||||||
if /i "%audidata4%"=="LTSC" set ltsc19=LTSC
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\ProductReleaseIDs\%_actconfig%" /s %nul6%') do (
|
||||||
echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
|
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
|
||||||
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021
|
echo "%%b" %nul2% | findstr "16.0.17932" %nul% && set ltsc24=LTSC2024
|
||||||
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
|
|
||||||
|
|
||||||
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
|
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
|
||||||
|
|
||||||
@ -1352,10 +1479,16 @@ if ($appIdsList.Count -gt 0) {
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
@ -1402,6 +1535,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
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
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1412,16 +1546,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_sppissue
|
:dk_sppissue
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start %_slser% %nul%
|
||||||
set spperror=%errorlevel%
|
set spperror=%errorlevel%
|
||||||
|
|
||||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||||
%eline%
|
%eline%
|
||||||
echo sc start sppsvc [Error Code: %spperror%]
|
echo sc start %_slser% [Error Code: %spperror%]
|
||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
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
|
exit /b
|
||||||
|
|
||||||
:: Common lines used in PowerShell reflection code
|
:: Common lines used in PowerShell reflection code
|
||||||
@ -1439,8 +1573,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else if exist %ps% (
|
||||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
|
) else if not exist %ps% (
|
||||||
|
echo %~3
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1448,8 +1584,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
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'
|
%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
|
exit /b
|
||||||
|
|
||||||
@ -1464,7 +1602,8 @@ if defined fixes (
|
|||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -65,6 +65,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -139,9 +141,9 @@ goto dk_done
|
|||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 7600 (
|
||||||
%nceline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -193,16 +195,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -232,7 +236,13 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -314,7 +324,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -354,6 +364,9 @@ if not exist %SysPath%\%%# (
|
|||||||
%eline%
|
%eline%
|
||||||
echo [%SysPath%\%%#] file is missing, aborting...
|
echo [%SysPath%\%%#] file is missing, aborting...
|
||||||
echo:
|
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
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
@ -387,8 +400,7 @@ if not defined allapps (
|
|||||||
%eline%
|
%eline%
|
||||||
echo Failed to find activation IDs. Aborting...
|
echo Failed to find activation IDs. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -410,8 +422,7 @@ if not defined osedition (
|
|||||||
%eline%
|
%eline%
|
||||||
echo Failed to detect OS edition, aborting...
|
echo Failed to detect OS edition, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -792,7 +803,7 @@ exit /b
|
|||||||
|
|
||||||
:: https://stackoverflow.com/a/46268232
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
set "ddf="%SystemRoot%\Temp\ddf""
|
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
||||||
%nul% del /q /f %ddf%
|
%nul% del /q /f %ddf%
|
||||||
echo/.New Cabinet>%ddf%
|
echo/.New Cabinet>%ddf%
|
||||||
echo/.set Cabinet=ON>>%ddf%
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
@ -824,10 +835,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
@ -901,6 +918,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
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
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -911,16 +929,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_sppissue
|
:dk_sppissue
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start %_slser% %nul%
|
||||||
set spperror=%errorlevel%
|
set spperror=%errorlevel%
|
||||||
|
|
||||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||||
%eline%
|
%eline%
|
||||||
echo sc start sppsvc [Error Code: %spperror%]
|
echo sc start %_slser% [Error Code: %spperror%]
|
||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
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
|
exit /b
|
||||||
|
|
||||||
:: Common lines used in PowerShell reflection code
|
:: Common lines used in PowerShell reflection code
|
||||||
@ -1018,8 +1036,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else if exist %ps% (
|
||||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
|
) else if not exist %ps% (
|
||||||
|
echo %~3
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1027,8 +1047,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
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'
|
%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
|
exit /b
|
||||||
|
|
||||||
@ -1043,7 +1065,8 @@ if defined fixes (
|
|||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +60,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: Check if Null service is working, it's important for the batch script
|
||||||
|
|
||||||
@ -129,13 +131,30 @@ echo:
|
|||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %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%
|
%nceline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
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
|
goto done2
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -187,16 +206,18 @@ goto done2
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -226,7 +247,13 @@ goto done2
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -308,7 +335,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -714,7 +741,8 @@ if defined fixes (
|
|||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
@ -732,10 +760,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
@ -791,8 +825,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else if exist %ps% (
|
||||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
|
) else if not exist %ps% (
|
||||||
|
echo %~3
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -800,8 +836,10 @@ exit /b
|
|||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
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'
|
%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
|
exit /b
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@set masver=3.0
|
@set masver=3.3
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +60,8 @@ exit /b
|
|||||||
|
|
||||||
set "blank="
|
set "blank="
|
||||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
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
|
:: 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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 6001 (
|
||||||
%nceline%
|
%nceline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -188,16 +207,18 @@ goto dk_done
|
|||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
::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=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
%eline%
|
%eline%
|
||||||
echo: %tstresult%
|
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
echo Test 1 - %tstresult%
|
||||||
|
echo Test 2 - !tstresult2!
|
||||||
|
echo:
|
||||||
|
|
||||||
REM check LanguageMode
|
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 FullLanguage mode not found in PowerShell. Aborting...
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
echo:
|
echo:
|
||||||
@ -227,7 +248,13 @@ goto dk_done
|
|||||||
REM check antivirus and other errors
|
REM check antivirus and other errors
|
||||||
|
|
||||||
echo PowerShell is not working properly. Aborting...
|
echo PowerShell is not working properly. Aborting...
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
|
if /i "!tstresult2!"=="FullLanguage" (
|
||||||
|
echo:
|
||||||
|
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@ -309,7 +336,7 @@ echo:
|
|||||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start %mas% & exit /b)
|
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -370,7 +397,7 @@ if %_erl%==5 goto:retokens
|
|||||||
if %_erl%==4 goto:fixwmi
|
if %_erl%==4 goto:fixwmi
|
||||||
if %_erl%==3 goto:sfcscan
|
if %_erl%==3 goto:sfcscan
|
||||||
if %_erl%==2 goto:dism_rest
|
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
|
goto :at_menu
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@ -515,6 +542,13 @@ mode 125, 32
|
|||||||
)
|
)
|
||||||
title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^)
|
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:
|
||||||
echo %line%
|
echo %line%
|
||||||
echo:
|
echo:
|
||||||
@ -531,7 +565,7 @@ echo - Clear ClipSVC, SPP and OSPP licenses.
|
|||||||
echo - Fix permissions of SPP tokens folder and registries.
|
echo - Fix permissions of SPP tokens folder and registries.
|
||||||
echo - Trigger the repair option for Office.
|
echo - Trigger the repair option for Office.
|
||||||
echo:
|
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:
|
||||||
echo %line%
|
echo %line%
|
||||||
echo:
|
echo:
|
||||||
@ -695,21 +729,21 @@ echo [No Error Found]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Stopping sppsvc service...
|
echo Stopping %_slser% service...
|
||||||
%psc% Stop-Service sppsvc -force %nul%
|
%psc% Stop-Service %_slser% -force %nul%
|
||||||
|
|
||||||
set w=
|
set w=
|
||||||
set _sppint=
|
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 (
|
if defined _sppint (
|
||||||
echo:
|
echo:
|
||||||
echo Removing SPP IFEO registry keys...
|
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 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:
|
||||||
echo Checking Update KB971033...
|
echo Checking Update KB971033...
|
||||||
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
|
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
|
||||||
@ -726,6 +760,7 @@ del /f /q %SysPath%\7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-81
|
|||||||
|
|
||||||
:: Delete registry keys that are not deleted by activation scripts
|
:: Delete registry keys that are not deleted by activation scripts
|
||||||
|
|
||||||
|
if not defined _vis (
|
||||||
echo:
|
echo:
|
||||||
echo Cleaning some licensing-related registry keys...
|
echo Cleaning some licensing-related registry keys...
|
||||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f
|
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f
|
||||||
@ -733,6 +768,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 "PolicyValuesArray" /f
|
||||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f
|
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f
|
||||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f
|
%nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
call :scandat delete
|
call :scandat delete
|
||||||
@ -744,9 +780,13 @@ call :dk_color %Red% "Failed to delete .dat files."
|
|||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if defined _vis (
|
||||||
|
%psc% Start-Service %_slser% %nul%
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Reinstalling system licenses...
|
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%
|
%psc% "$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%
|
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||||
if %errorlevel% EQU 0 (
|
if %errorlevel% EQU 0 (
|
||||||
echo [Successful]
|
echo [Successful]
|
||||||
@ -763,7 +803,7 @@ call :dk_color %Red% "Failed to rebuild tokens.dat file."
|
|||||||
echo tokens.dat file was rebuilt successfully.
|
echo tokens.dat file was rebuilt successfully.
|
||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% LSS 9200 (
|
if %winbuild% LSS 9200 if not defined _vis (
|
||||||
sc config sppuinotify start= demand
|
sc config sppuinotify start= demand
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -844,12 +884,12 @@ set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
|
|||||||
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
|
reg query %_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=")
|
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 %_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\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 %_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\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15)
|
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\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 %_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\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16)
|
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\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 %_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 %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe)
|
for /f "skip=2 tokens=2*" %%a in ('"reg query %_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 +1188,7 @@ goto :at_menu
|
|||||||
|
|
||||||
:: https://stackoverflow.com/a/46268232
|
:: https://stackoverflow.com/a/46268232
|
||||||
|
|
||||||
set "ddf="%SystemRoot%\Temp\ddf""
|
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
||||||
%nul% del /q /f %ddf%
|
%nul% del /q /f %ddf%
|
||||||
echo/.New Cabinet>%ddf%
|
echo/.New Cabinet>%ddf%
|
||||||
echo/.set Cabinet=ON>>%ddf%
|
echo/.set Cabinet=ON>>%ddf%
|
||||||
@ -1200,7 +1240,7 @@ set "permerror=Error Found In SPP Registries"
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
if not defined permerror (
|
if not defined permerror (
|
||||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
@ -1246,7 +1286,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Fix perms for SPP in HKU\S-1-5-20
|
# 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') {
|
if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') {
|
||||||
exit
|
exit
|
||||||
@ -1329,13 +1369,13 @@ function InstallLicenseArr($Str) {
|
|||||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||||
}
|
}
|
||||||
function InstallLicenseDir($Loc) {
|
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() {
|
function ReinstallLicenses() {
|
||||||
$Oem = "$env:SysPath\oem"
|
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||||
$Spp = "$env:SysPath\spp\tokens"
|
foreach ($Path in $Paths) {
|
||||||
InstallLicenseDir "$Spp"
|
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
}
|
||||||
}
|
}
|
||||||
:xrm:
|
:xrm:
|
||||||
|
|
||||||
@ -1349,6 +1389,7 @@ for %%# in (
|
|||||||
%SysPath%\spp\store\
|
%SysPath%\spp\store\
|
||||||
%SysPath%\spp\store\2.0\
|
%SysPath%\spp\store\2.0\
|
||||||
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
|
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
|
||||||
|
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\
|
||||||
) do (
|
) do (
|
||||||
|
|
||||||
if %1==check (
|
if %1==check (
|
||||||
@ -1424,14 +1465,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
|
:dk_done
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
|
if %_unattended%==1 timeout /t 2 & exit /b
|
||||||
|
|
||||||
if defined fixes (
|
if defined fixes (
|
||||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
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"
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
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 (
|
if defined terminal (
|
||||||
@ -1441,26 +1509,7 @@ choice /c 0 /n
|
|||||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||||
pause %nul1%
|
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
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@ -1469,10 +1518,16 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe -nop -c
|
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||||
|
set psc=%ps% -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
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
|
set _NCS=1
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
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)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
|
225
README.md
225
README.md
@ -1,109 +1,116 @@
|
|||||||
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
||||||
|
|
||||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||||
|
|
||||||
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
## Download / How to use it?
|
## How to Activate Windows / Office?
|
||||||
|
|
||||||
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
### 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.
|
1. **Open PowerShell**
|
||||||
2. Copy and paste the code below and press enter
|
To do that, press the Windows key + X, then select PowerShell or Terminal.
|
||||||
```
|
|
||||||
irm https://get.activated.win | iex
|
2. **Copy and paste the code below, then press enter.**
|
||||||
```
|
```
|
||||||
Alternatively, you can use the following (It will be deprecated in the future.)
|
irm https://get.activated.win | iex
|
||||||
```
|
```
|
||||||
irm https://massgrave.dev/get | iex
|
Alternatively, you can use the following (this will be deprecated in the future):
|
||||||
```
|
```
|
||||||
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
|
irm https://massgrave.dev/get | iex
|
||||||
4. That's all.
|
```
|
||||||
|
|
||||||
---
|
3. You will see the activation options. Choose the activation options highlighted in green.
|
||||||
|
|
||||||
### Method 2 - Traditional (Windows 7 and later)
|
4. That's all
|
||||||
|
|
||||||
<details>
|
---
|
||||||
<summary>Click here for info</summary>
|
|
||||||
|
### Method 2 - Traditional (Windows Vista and later)
|
||||||
1. Download the file using the links provided below.
|
|
||||||
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
|
<details>
|
||||||
or
|
<summary>Click here to view</summary>
|
||||||
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
|
|
||||||
2. Right-click on the downloaded zip file and extract
|
1. Download the file using one of the links below:
|
||||||
3. In the extracted folder, find the folder named `All-In-One-Version`
|
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
|
||||||
4. Run the file named `MAS_AIO.cmd`
|
or
|
||||||
5. You will see the activation options, follow the on-screen instructions.
|
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
|
||||||
6. That's all.
|
2. Right-click on the downloaded zip file and extract it.
|
||||||
|
3. In the extracted folder, find the folder named `All-In-One-Version`.
|
||||||
</details>
|
4. Run the file named `MAS_AIO.cmd`.
|
||||||
|
5. You will see the activation options. Follow the on-screen instructions.
|
||||||
---
|
6. That's all.
|
||||||
|
|
||||||
### Not working ❓
|
</details>
|
||||||
|
|
||||||
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
|
---
|
||||||
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
|
|
||||||
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
|
- 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).
|
||||||
---
|
|
||||||
|
---
|
||||||
> [!NOTE]
|
|
||||||
>
|
### Not working ❓
|
||||||
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
|
|
||||||
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
|
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
|
||||||
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
|
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
|
||||||
|
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
|
||||||
---
|
|
||||||
|
---
|
||||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
|
||||||
|
> [!NOTE]
|
||||||
```
|
>
|
||||||
Latest Version: 3.0
|
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
|
||||||
Release date: 14-Feb-2025
|
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
|
||||||
```
|
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
|
||||||
|
|
||||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
---
|
||||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
|
||||||
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
```
|
||||||
|
Latest Version: 3.3
|
||||||
<div align="center">
|
Release date: 1-June-2025
|
||||||
|
```
|
||||||
[![1.1]][1]
|
|
||||||
[![1.2]][2]
|
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||||
[![1.3]][3]
|
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||||
|
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
||||||
</div>
|
|
||||||
|
<div align="center">
|
||||||
<div align="center">
|
|
||||||
|
[![1.1]][1]
|
||||||
[![1.4]][4]
|
[![1.2]][2]
|
||||||
[![1.5]][5]
|
[![1.3]][3]
|
||||||
[![1.6]][6]
|
|
||||||
[![1.7]][7]
|
</div>
|
||||||
|
|
||||||
</div>
|
<div align="center">
|
||||||
|
|
||||||
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
|
[![1.4]][4]
|
||||||
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
|
[![1.5]][5]
|
||||||
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
|
[![1.6]][6]
|
||||||
|
[![1.7]][7]
|
||||||
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
|
||||||
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
</div>
|
||||||
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
|
|
||||||
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
|
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
|
||||||
|
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
|
||||||
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
|
||||||
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
|
|
||||||
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
|
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
||||||
[4]: https://discord.gg/j2yFsV5ZVC
|
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
||||||
[5]: https://www.reddit.com/r/MAS_Activator
|
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
|
||||||
[6]: https://bsky.app/profile/massgrave.dev
|
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
|
||||||
[7]: https://twitter.com/massgravel
|
|
||||||
|
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
||||||
---
|
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
|
||||||
|
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
|
||||||
<p align="center">Made with Love ❤️</p>
|
[4]: https://discord.gg/j2yFsV5ZVC
|
||||||
|
[5]: https://www.reddit.com/r/MAS_Activator
|
||||||
|
[6]: https://bsky.app/profile/massgrave.dev
|
||||||
|
[7]: https://twitter.com/massgravel
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<p align="center">Made with Love ❤️</p>
|
||||||
|
Reference in New Issue
Block a user