Compare commits
No commits in common. "8e3b4135f56d14b86ccaa96014bc5eb9b6b5f80d" and "601bd0e42006069cd0de2b58c09fbca34e1ec8d8" have entirely different histories.
8e3b4135f5
...
601bd0e420
1
LICENSE
1
LICENSE
|
@ -672,3 +672,4 @@ may consider it more useful to permit linking proprietary applications with
|
|||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -27,7 +27,7 @@ set "_debug=0"
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
@ -160,22 +160,22 @@ call :dk_setvar
|
|||
if %winbuild% LSS 10240 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo HWID Activation is only supported on Windows 10/11.
|
||||
echo HWID Activation is supported only for Windows 10/11.
|
||||
echo:
|
||||
call :dk_color %Blue% "Use Online KMS activation option."
|
||||
call :dk_color %Blue% "Use Online KMS Activation option."
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
%eline%
|
||||
echo HWID Activation is not supported on Windows Server.
|
||||
call :dk_color %Blue% "Use KMS38 or Online KMS activation option."
|
||||
echo HWID Activation is not supported for Windows Server.
|
||||
call :dk_color %Blue% "Use KMS38 or Online KMS Activation option."
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
@ -195,8 +195,8 @@ setlocal EnableDelayedExpansion
|
|||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo Script is launched from the temp folder,
|
||||
echo Most likely you are running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto dk_done
|
||||
|
@ -237,7 +237,7 @@ goto dk_done
|
|||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
|
@ -290,20 +290,20 @@ set -=
|
|||
set old=
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo Version %masver% of MAS is outdated.
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
|
@ -329,7 +329,7 @@ ClipUp.exe
|
|||
) do (
|
||||
if not exist %SysPath%\%%# (
|
||||
%eline%
|
||||
echo [%SysPath%\%%#] file is missing, aborting...
|
||||
echo [%SysPath%\%%#] file is missing. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -356,12 +356,12 @@ if defined _perm (
|
|||
cls
|
||||
echo ___________________________________________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
|
||||
call :dk_color2 %_White% " " %Green% "Checking: %winos% is Permanently Activated."
|
||||
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
||||
echo ___________________________________________________________________________________________
|
||||
if %_unattended%==1 goto dk_done
|
||||
echo:
|
||||
choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
|
||||
choice /C:10 /N /M "> [1] Activate [0] %_exitmsg% : "
|
||||
if errorlevel 2 exit /b
|
||||
)
|
||||
cls
|
||||
|
@ -375,10 +375,10 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2
|
|||
%eline%
|
||||
echo [%winos% ^| %winbuild%]
|
||||
echo:
|
||||
echo Evaluation editions cannot be activated outside of their evaluation period.
|
||||
echo Evaluation Editions cannot be activated outside of evaluation period.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
@ -395,7 +395,7 @@ call :dk_showosinfo
|
|||
|
||||
set _int=
|
||||
for %%a in (l.root-servers.net resolver1.opendns.com download.windowsupdate.com google.com) do if not defined _int (
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not "%%#"=="" set _int=1)
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not [%%#]==[] set _int=1)
|
||||
)
|
||||
|
||||
if not defined _int (
|
||||
|
@ -408,7 +408,7 @@ echo Checking Internet Connection [Connected%ping_f%]
|
|||
) else (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Internet Connection [Not Connected]"
|
||||
call :dk_color %Blue% "Internet is required for HWID activation."
|
||||
call :dk_color %Blue% "Internet is required for HWID Activation."
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -457,13 +457,13 @@ if not defined key (
|
|||
%eline%
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support HWID activation.
|
||||
echo Make sure you are using the latest version of the script.
|
||||
echo If you are, then try KMS38 activation option.
|
||||
echo This product does not support HWID Activation.
|
||||
echo Try KMS38 Activation option.
|
||||
echo Make sure you are using updated version of the script.
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
) else (
|
||||
echo Required license files not found in %SysPath%\spp\tokens\skus\
|
||||
echo Required License files not found in %SysPath%\spp\tokens\skus\
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -479,12 +479,12 @@ if defined notworking set error=1
|
|||
|
||||
echo:
|
||||
if defined changekey (
|
||||
call :dk_color %Blue% "[%altedition%] edition product key will be used to enable HWID activation."
|
||||
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable HWID activation."
|
||||
echo:
|
||||
)
|
||||
|
||||
if defined winsub (
|
||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script will activate base edition [SKU ID-%regSKU%]."
|
||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]."
|
||||
echo:
|
||||
)
|
||||
|
||||
|
@ -526,7 +526,7 @@ call :hwiddata ticket
|
|||
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
||||
|
||||
if not exist "%tdir%\GenuineTicket.xml" (
|
||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
|
||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]"
|
||||
echo [%encoded%]
|
||||
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
||||
goto :dl_final
|
||||
|
@ -544,7 +544,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||
%_xmlexist% (
|
||||
set error=1
|
||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -604,7 +604,7 @@ reg delete "%_ident%" /f %nul%
|
|||
reg query "%_ident%" %nul% && (
|
||||
echo:
|
||||
set error=1
|
||||
call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]"
|
||||
call :dk_color %Red% "Deleting an IdentityCRL Registry [Failed] [%_ident%]"
|
||||
)
|
||||
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
|
||||
call :dk_refresh
|
||||
|
@ -639,7 +639,7 @@ if not defined resfail (
|
|||
if defined resfail (
|
||||
set error=1
|
||||
echo:
|
||||
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]"
|
||||
call :dk_color %Red% "Checking Licensing Servers [Failed To Connect]"
|
||||
set fixes=%fixes% %mas%licensing-servers-issue
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||
)
|
||||
|
@ -702,8 +702,8 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
|
|||
) else (
|
||||
call :dk_color %Red% "Activation Failed %error_code%"
|
||||
if defined notworking (
|
||||
call :dk_color %Blue% "At the time of writing, HWID Activation is not supported for this product."
|
||||
call :dk_color %Blue% "Use KMS38 activation option instead."
|
||||
call :dk_color %Blue% "At the time of writing this, HWID Activation was not supported for this product."
|
||||
call :dk_color %Blue% "Use KMS38 Activation option."
|
||||
) else (
|
||||
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
|
@ -992,7 +992,7 @@ function ReinstallLicenses() {
|
|||
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@ -1072,7 +1072,7 @@ set pupfound=%pupfound1%%pupfound2%
|
|||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
if %hcount%==4 set "results=[AV URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
|
@ -1081,19 +1081,14 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
|
|||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
) || (
|
||||
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
)
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
|
||||
|
||||
if not "%results%%pupfound%"=="" (
|
||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||
if defined results call :dk_color %Red% "%results%"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%"
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
|
@ -1112,7 +1107,7 @@ call :dk_chkmal
|
|||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||
call :dk_color %Red% "Checking Sandboxing [Found. Script may not work properly.]"
|
||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
echo:
|
||||
)
|
||||
|
@ -1136,7 +1131,6 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
|
|||
|
||||
if defined serv_cor (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||
)
|
||||
|
||||
|
@ -1203,7 +1197,7 @@ if defined serv_e (
|
|||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Restart the system to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
@ -1243,7 +1237,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
|
|||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
@ -1253,8 +1247,8 @@ if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1282,7 +1276,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
|
|||
|
||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1353,7 +1347,7 @@ echo Checking Eval WLMS Service [Found]
|
|||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -1378,7 +1372,7 @@ set error=1
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
|
@ -1408,11 +1402,10 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||
%psc% "!d!" %nul%
|
||||
if exist "%tokenstore%\" (
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]"
|
||||
) else (
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1459,13 +1452,7 @@ for %%# in (
|
|||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||
if !errorlevel!==2 (
|
||||
if "%%A"=="%tokenstore%" (
|
||||
set "permerror=Error Found In Token Folder"
|
||||
) else (
|
||||
set "permerror=Error Found In SPP Registries"
|
||||
)
|
||||
)
|
||||
if !errorlevel!==2 set permerror=Error_Found
|
||||
)
|
||||
|
||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
|
@ -1528,7 +1515,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||
}
|
||||
for ($i=1; $i -le $count; $i++) {
|
||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||
Write-Output "Total Keys $count. Error Found - $i key does not exist."
|
||||
Write-Output "Total Keys $count. Error Found- $i key does not exist"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1539,7 +1526,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1547,7 +1534,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
$subkey = $wpaKey.OpenSubKey($_)
|
||||
$p = $subkey.GetValueNames()
|
||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1586,13 +1573,13 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %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 %_exitmsg%..."
|
||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
|
|
|
@ -30,7 +30,7 @@ set "_debug=0"
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
@ -166,19 +166,19 @@ set "specific_kms=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectio
|
|||
if %winbuild% LSS 14393 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo KMS38 activation is only supported on Windows 10/11/Server, build 14393 and later.
|
||||
echo KMS38 Activation is supported for Windows 10/11/Server, build 14393 and later.
|
||||
echo:
|
||||
if %winbuild% LSS 10240 (
|
||||
call :dk_color %Blue% "Use Online KMS activation option."
|
||||
call :dk_color %Blue% "Use Online KMS Activation option."
|
||||
) else (
|
||||
call :dk_color %Blue% "Use HWID activation option."
|
||||
call :dk_color %Blue% "Use HWID Activation option."
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
@ -198,8 +198,8 @@ setlocal EnableDelayedExpansion
|
|||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo Script is launched from the temp folder,
|
||||
echo Most likely you are running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto dk_done
|
||||
|
@ -240,7 +240,7 @@ goto dk_done
|
|||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
|
@ -293,20 +293,20 @@ set -=
|
|||
set old=
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo Version %masver% of MAS is outdated.
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
|
@ -339,7 +339,7 @@ echo:
|
|||
echo [0] %_exitmsg%
|
||||
echo ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]"
|
||||
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,0]"
|
||||
choice /C:120 /N
|
||||
set _el=!errorlevel!
|
||||
if !_el!==3 exit /b
|
||||
|
@ -369,7 +369,7 @@ if not exist %SysPath%\ClipUp.exe if not defined a_cor (set _fmiss=%_fmiss%ClipU
|
|||
|
||||
if defined _fmiss (
|
||||
%eline%
|
||||
echo [%_fmiss%] file is missing, aborting...
|
||||
echo [%_fmiss%] file is missing. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -395,12 +395,12 @@ if defined _perm (
|
|||
cls
|
||||
echo ___________________________________________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
|
||||
call :dk_color2 %_White% " " %Green% "Checking: %winos% is Permanently Activated."
|
||||
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
||||
echo ___________________________________________________________________________________________
|
||||
if %_unattended%==1 goto dk_done
|
||||
echo:
|
||||
choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
|
||||
choice /C:10 /N /M "> [1] Activate [0] %_exitmsg% : "
|
||||
if errorlevel 2 exit /b
|
||||
)
|
||||
cls
|
||||
|
@ -425,10 +425,10 @@ echo Server Evaluation cannot be activated. Convert it to full Server OS.
|
|||
echo:
|
||||
call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
|
||||
) else (
|
||||
echo Evaluation editions cannot be activated outside of their evaluation period.
|
||||
echo Evaluation Editions cannot be activated outside of evaluation period.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
|
@ -441,9 +441,9 @@ goto dk_done
|
|||
if defined a_cor (
|
||||
if not exist "!_work!\clipup.exe" (
|
||||
%eline%
|
||||
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
|
||||
echo The file is required for KMS38 activation.
|
||||
echo Check the below page for instructions on how to activate it.
|
||||
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] version.
|
||||
echo It's required for KMS38 Activation.
|
||||
echo Check below page on how to activate it.
|
||||
set fixes=%fixes% %mas%kms38
|
||||
echo %mas%kms38
|
||||
goto dk_done
|
||||
|
@ -496,24 +496,24 @@ set /a UBR=0
|
|||
if %osSKU%==191 if defined altkey if defined altedition (
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
|
||||
if %winbuild% LSS 22598 if !UBR! LSS 2788 (
|
||||
call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
|
||||
call :dk_color %Blue% "Windows must to be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
|
||||
)
|
||||
)
|
||||
|
||||
if not defined key if defined notfoundaltactID (
|
||||
call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Activation ID Not Found]"
|
||||
call :dk_color %Red% "Checking Alternate Edition For KMS38 [%altedition% Activation ID Not Found]"
|
||||
)
|
||||
|
||||
if not defined key if not defined _gvlk (
|
||||
%eline%
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support KMS38 activation.
|
||||
echo Make sure you are using the latest version of the script.
|
||||
echo This product does not support KMS38 Activation.
|
||||
echo Make sure you are using updated version of the script.
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
) else (
|
||||
echo Required license files were not found in %SysPath%\spp\tokens\skus\
|
||||
echo Required License files not found in %SysPath%\spp\tokens\skus\
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -527,12 +527,12 @@ goto dk_done
|
|||
|
||||
echo:
|
||||
if defined changekey (
|
||||
call :dk_color %Blue% "[%altedition%] edition product key will be used to enable KMS38 activation."
|
||||
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable KMS38 activation."
|
||||
echo:
|
||||
)
|
||||
|
||||
if defined winsub (
|
||||
call :dk_color %Blue% "Windows Subscription edition [SKU ID-%slcSKU%] found. Script will activate the base edition [SKU ID-%regSKU%]."
|
||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]."
|
||||
echo:
|
||||
)
|
||||
|
||||
|
@ -629,7 +629,7 @@ set "sessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAV
|
|||
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
||||
|
||||
if not exist "%tdir%\GenuineTicket.xml" (
|
||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
|
||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]"
|
||||
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
||||
goto :k_final
|
||||
) else (
|
||||
|
@ -656,7 +656,7 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|||
%_xmlexist% (
|
||||
set error=1
|
||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -732,16 +732,16 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
|||
|
||||
:k_final
|
||||
|
||||
:: Remove the specific KMS host (LocalHost) added by the script if activation is not completed
|
||||
:: Remove the added Specific KMS Host (Local Host) if activation is not completed
|
||||
|
||||
echo:
|
||||
if not defined _k38 (
|
||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
|
||||
%nul% reg query "HKLM\%specific_kms%" && (
|
||||
call :dk_color %Red% "Removing the Added Specific KMS Host [Failed]"
|
||||
call :dk_color %Red% "Removing The Added Specific KMS Host [Failed]"
|
||||
) || (
|
||||
echo Removing the Added Specific KMS Host [Successful]
|
||||
echo Removing The Added Specific KMS Host [Successful]
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -751,9 +751,9 @@ if defined _k38 (
|
|||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
|
||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||
%nul% reg query "HKLM\%specific_kms%" && (
|
||||
echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
|
||||
echo Protect KMS38 From KMS [Successful] [Locked A Registry Key]
|
||||
) || (
|
||||
call :dk_color %Red% "Protect KMS38 From KMS [Failed to Lock a Registry Key]"
|
||||
call :dk_color %Red% "Protect KMS38 From KMS [Failed To Lock A Registry Key]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -763,9 +763,9 @@ if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul%
|
|||
|
||||
if defined a_cor (
|
||||
if exist "%_clipup%" (
|
||||
call :dk_color %Red% "Deleting Copied clipup.exe File [Failed]"
|
||||
call :dk_color %Red% "Deleting copied clipup.exe file [Failed]"
|
||||
) else (
|
||||
echo Deleting Copied clipup.exe File [Successful]
|
||||
echo Deleting copied clipup.exe file [Successful]
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ function ReinstallLicenses() {
|
|||
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@ -1190,7 +1190,7 @@ for %%# in (pkeyhelper.dll) do @if "%%~$PATH:#"=="" exit /b
|
|||
for %%# in (Volume:GVLK) do (
|
||||
call :k_pkey %osSKU% '%%#'
|
||||
if defined pkey call :k_pkeychannel !pkey!
|
||||
if /i "!pkeychannel!"=="%%#" (
|
||||
if /i [!pkeychannel!]==[%%#] (
|
||||
set key=!pkey!
|
||||
exit /b
|
||||
)
|
||||
|
@ -1215,7 +1215,7 @@ set pupfound=%pupfound1%%pupfound2%
|
|||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
if %hcount%==4 set "results=[AV URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
|
@ -1224,19 +1224,14 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
|
|||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
) || (
|
||||
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
)
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
|
||||
|
||||
if not "%results%%pupfound%"=="" (
|
||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||
if defined results call :dk_color %Red% "%results%"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%"
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
|
@ -1255,7 +1250,7 @@ call :dk_chkmal
|
|||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||
call :dk_color %Red% "Checking Sandboxing [Found. Script may not work properly.]"
|
||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
echo:
|
||||
)
|
||||
|
@ -1279,7 +1274,6 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
|
|||
|
||||
if defined serv_cor (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||
)
|
||||
|
||||
|
@ -1346,7 +1340,7 @@ if defined serv_e (
|
|||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Restart the system to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
@ -1386,7 +1380,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
|
|||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
@ -1396,8 +1390,8 @@ if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1425,7 +1419,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
|
|||
|
||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1496,7 +1490,7 @@ echo Checking Eval WLMS Service [Found]
|
|||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -1521,7 +1515,7 @@ set error=1
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
|
@ -1551,11 +1545,10 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||
%psc% "!d!" %nul%
|
||||
if exist "%tokenstore%\" (
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]"
|
||||
) else (
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1602,13 +1595,7 @@ for %%# in (
|
|||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||
if !errorlevel!==2 (
|
||||
if "%%A"=="%tokenstore%" (
|
||||
set "permerror=Error Found In Token Folder"
|
||||
) else (
|
||||
set "permerror=Error Found In SPP Registries"
|
||||
)
|
||||
)
|
||||
if !errorlevel!==2 set permerror=Error_Found
|
||||
)
|
||||
|
||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
|
@ -1671,7 +1658,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||
}
|
||||
for ($i=1; $i -le $count; $i++) {
|
||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||
Write-Output "Total Keys $count. Error Found - $i key does not exist."
|
||||
Write-Output "Total Keys $count. Error Found- $i key does not exist"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1682,7 +1669,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1690,7 +1677,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
$subkey = $wpaKey.OpenSubKey($_)
|
||||
$p = $subkey.GetValueNames()
|
||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1729,13 +1716,13 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %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 %_exitmsg%..."
|
||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
|
|
|
@ -27,7 +27,7 @@ set "_debug=0"
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
@ -160,15 +160,15 @@ call :dk_setvar
|
|||
if %winbuild% LSS 9200 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Ohook Activation is supported only on Windows 8/10/11 and their server equivalents.
|
||||
echo Ohook Activation is supported on Windows 8 and later and their server equivalent.
|
||||
echo:
|
||||
call :dk_color %Blue% "Use Online KMS activation option instead."
|
||||
call :dk_color %Blue% "Use Online KMS Activation option."
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
@ -188,8 +188,8 @@ setlocal EnableDelayedExpansion
|
|||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo Script is launched from the temp folder,
|
||||
echo Most likely you are running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto dk_done
|
||||
|
@ -230,7 +230,7 @@ goto dk_done
|
|||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
|
@ -283,20 +283,20 @@ set -=
|
|||
set old=
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo Version %masver% of MAS is outdated.
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
|
@ -332,7 +332,7 @@ echo:
|
|||
echo [0] %_exitmsg%
|
||||
echo ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,0]"
|
||||
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,3,0]"
|
||||
choice /C:1230 /N
|
||||
set _el=!errorlevel!
|
||||
if !_el!==4 exit /b
|
||||
|
@ -360,7 +360,7 @@ call :dk_chkmal
|
|||
|
||||
if not exist %SysPath%\sppsvc.exe (
|
||||
%eline%
|
||||
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
||||
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -456,10 +456,10 @@ call :dk_color %Red% "Checking Installed Office [Not Found]"
|
|||
|
||||
if defined ohub (
|
||||
echo:
|
||||
echo You only have the Office dashboard app installed, you need to install the full version of Office.
|
||||
echo You have only Office dashboard app installed, you need to install full Office version.
|
||||
)
|
||||
echo:
|
||||
call :dk_color %Blue% "Download and install Office from the below URL and then try again."
|
||||
call :dk_color %Blue% "Download and install Office from below URL and try again."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%genuine-installation-media
|
||||
call :dk_color %_Yellow% "%mas%genuine-installation-media"
|
||||
|
@ -471,7 +471,7 @@ if not "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="1" set multioffice=1
|
|||
if not "%o14msi%%o14c2r%%o16uwp%"=="" set multioffice=1
|
||||
|
||||
if defined multioffice (
|
||||
call :dk_color %Gray% "Checking Multiple Office Install [Found, its recommended to install only one version]"
|
||||
call :dk_color %Gray% "Checking Multiple Office Install [Found. Recommended to install one version only]"
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -520,11 +520,11 @@ echo "!_oIds!" | find /i " %%a " %nul1% || (set "_oIds= !_oIds! %%a ")
|
|||
set "_oLPath=%_oRoot%\Licenses"
|
||||
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
|
||||
if "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
if not "%osarch%"=="x86" (
|
||||
if "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
if "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
|
||||
if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
if not [%osarch%]==[x86] (
|
||||
if [%_oArch%]==[x64] set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
if [%_oArch%]==[x86] set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
|
||||
) else (
|
||||
set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
)
|
||||
|
@ -570,11 +570,11 @@ set _o16c2rIds=%_oIds%
|
|||
set "_oLPath=%_oRoot%\Licenses16"
|
||||
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
|
||||
if "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
if not "%osarch%"=="x86" (
|
||||
if "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
if "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
|
||||
if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
if not [%osarch%]==[x86] (
|
||||
if [%_oArch%]==[x64] set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
if [%_oArch%]==[x86] set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
|
||||
) else (
|
||||
set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
)
|
||||
|
@ -613,13 +613,13 @@ call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Of
|
|||
set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663"
|
||||
echo "%_oIds%" | find /i "Volume" %nul1% && (
|
||||
if %winbuild% GEQ 9200 (
|
||||
if not "%osarch%"=="x86" (
|
||||
if not [%osarch%]==[x86] (
|
||||
reg delete "%kmskey%" /f /reg:32 %nul%
|
||||
reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" /reg:32 %nul%
|
||||
)
|
||||
reg delete "%kmskey%" /f %nul%
|
||||
reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" %nul%
|
||||
echo Adding a Registry to Prevent Banner [Successful]
|
||||
echo Adding a Reg To Prevent Banner [Successful]
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -667,7 +667,7 @@ call :oh_reset
|
|||
call :oh_getpath
|
||||
|
||||
echo:
|
||||
echo Uninstalling Ohook activation...
|
||||
echo Uninstalling Ohook Activation...
|
||||
echo:
|
||||
|
||||
if defined o16c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg% /v InstallPath" %nul6%') do (set "_16CHook=%%b\root\vfs"))
|
||||
|
@ -698,7 +698,7 @@ if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" (set _present=1& del /s /f
|
|||
|
||||
reg query HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && (
|
||||
echo:
|
||||
echo Deleting - Registry keys for skipping license check
|
||||
echo Deleting - Registry keys to skip license check from all ^& future new useraccounts
|
||||
|
||||
reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
|
||||
reg query HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && reg delete HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
|
||||
|
@ -723,7 +723,7 @@ reg unload HKU\%%# %nul%
|
|||
set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663"
|
||||
reg query "%kmskey%" %nul% && (
|
||||
echo:
|
||||
echo Deleting - Registry keys for preventing non-genuine banner
|
||||
echo Deleting - Registry keys to prevent non-genuine banner
|
||||
reg delete "%kmskey%" /f
|
||||
)
|
||||
|
||||
|
@ -735,16 +735,16 @@ echo ___________________________________________________________________________
|
|||
echo:
|
||||
|
||||
if not defined _present (
|
||||
echo Ohook activation is not installed.
|
||||
echo Ohook Activation is not installed.
|
||||
) else (
|
||||
if defined _unerror (
|
||||
call :dk_color %Red% "Failed to uninstall Ohook activation."
|
||||
call :oh_checkapps
|
||||
if defined checknames (
|
||||
call :dk_color %Blue% "Close [!checknames!] and try again."
|
||||
call :dk_color %Blue% "If it is still not fixed, then restart your system and try again."
|
||||
call :dk_color %Blue% "If its still not resolved then restart system and try again."
|
||||
) else (
|
||||
call :dk_color %Blue% "Restart your system and try again."
|
||||
call :dk_color %Blue% "Restart system and try again."
|
||||
)
|
||||
) else (
|
||||
call :dk_color %Green% "Successfully uninstalled Ohook activation."
|
||||
|
@ -919,11 +919,11 @@ if not exist "%_hookPath%\sppc.dll" (if not defined ierror set ierror=Copy)
|
|||
|
||||
echo:
|
||||
if not defined ierror (
|
||||
echo Symlinking System's sppc.dll to ["%_hookPath%\sppcs.dll"] [Successful]
|
||||
echo Symlinking System's sppc.dll To ["%_hookPath%\sppcs.dll"] [Successful]
|
||||
if defined exhook (
|
||||
echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
||||
echo Copying Custom %_hook% To ["%_hookPath%\sppc.dll"] [Successful]
|
||||
) else (
|
||||
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
|
||||
echo Extracting Custom %_hook% To ["%_hookPath%\sppc.dll"] [Successful]
|
||||
)
|
||||
) else (
|
||||
set error=1
|
||||
|
@ -932,9 +932,9 @@ echo:
|
|||
call :oh_checkapps
|
||||
if defined checknames (
|
||||
call :dk_color %Blue% "Close [!checknames!] and try again."
|
||||
call :dk_color %Blue% "If it is still not fixed, then restart your system and try again."
|
||||
call :dk_color %Blue% "If its still not resolved then restart system and try again."
|
||||
) else (
|
||||
if /i not "%ierror%"=="Copy" call :dk_color %Blue% "Restart your system and try again."
|
||||
if /i not "%ierror%"=="Copy" call :dk_color %Blue% "Restart system and try again."
|
||||
if /i "%ierror%"=="Copy" call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
)
|
||||
echo:
|
||||
|
@ -976,13 +976,13 @@ set _prod=%%#!_preview!
|
|||
|
||||
call :ohookdata getinfo !_prod!
|
||||
|
||||
if not "!key!"=="" (
|
||||
if not [!key!]==[] (
|
||||
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
||||
call :dk_inskey "[!key!] [!_prod!] [!_lic!]"
|
||||
) else (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
|
||||
call :dk_color %Blue% "Make sure you are using the latest version of MAS."
|
||||
call :dk_color %Blue% "Make sure you are using Latest MAS script."
|
||||
set fixes=%fixes% %mas%
|
||||
call :dk_color %_Yellow% "%mas%"
|
||||
)
|
||||
|
@ -996,7 +996,7 @@ if defined winserver if defined _config (
|
|||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set scaIsNeeded=1
|
||||
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
||||
echo Adding SharedComputerLicensing Reg [Successful] [Needed on Server With Retail Office]"
|
||||
echo Adding SharedComputerLicensing Reg [Successful] [Needed On Server With Retail Office]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1017,14 +1017,14 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\ProductVersion /v LastPr
|
|||
if "%_oRoot:~-1%"=="\" set "_oRoot=%_oRoot:~0,-1%"
|
||||
|
||||
echo "%2" | find /i "Wow6432Node" %nul1% && set _oArch=x86
|
||||
if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64
|
||||
if "%osarch%"=="x86" set _oArch=x86
|
||||
if not [%osarch%]==[x86] if not defined _oArch set _oArch=x64
|
||||
if [%osarch%]==[x86] set _oArch=x86
|
||||
|
||||
if "%_oArch%"=="x64" (set "_hookPath=%_oRoot%" & set "_hook=sppc64.dll")
|
||||
if "%_oArch%"=="x86" (set "_hookPath=%_oRoot%" & set "_hook=sppc32.dll")
|
||||
if not "%osarch%"=="x86" (
|
||||
if "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
if "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
|
||||
if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%" & set "_hook=sppc64.dll")
|
||||
if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%" & set "_hook=sppc32.dll")
|
||||
if not [%osarch%]==[x86] (
|
||||
if [%_oArch%]==[x64] set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
if [%_oArch%]==[x86] set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll"
|
||||
) else (
|
||||
set "_sppcPath=%SystemRoot%\System32\sppc.dll"
|
||||
)
|
||||
|
@ -1043,13 +1043,13 @@ echo Activating Office... [MSI ^| %_version% ^| %_oArch%]
|
|||
|
||||
if not defined _oBranding (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]"
|
||||
call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
if not defined _oIds (
|
||||
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...]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -1187,10 +1187,8 @@ reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f /reg:32 %nul%
|
|||
)
|
||||
|
||||
reg delete "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
|
||||
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
|
||||
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul%
|
||||
|
||||
echo Clearing Office License Blocks [Successfully cleared from all %counter% user accounts]
|
||||
echo Clearing Office License Blocks [Successfully Cleared From All %counter% Useraccounts]
|
||||
|
||||
::==========================
|
||||
|
||||
|
@ -1208,7 +1206,7 @@ for %%# in (%_sidlist%) do (
|
|||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
echo Adding Reg Keys To Skip License Check [Successfully Added To All %counter% ^& Future New Useraccounts]
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1222,14 +1220,14 @@ reg query HKU\%%# %nul% && set failedtounload=1
|
|||
|
||||
if defined failedtoload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Restart your system and try again."
|
||||
call :dk_color %Red% "Loading Unloaded accounts Registry [Failed For Some Useraccounts]"
|
||||
call :dk_color %Blue% "Restart the system and try again."
|
||||
)
|
||||
|
||||
if defined failedtounload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Restart your system and try again."
|
||||
call :dk_color %Red% "Unloading loaded accounts Registry [Failed For Some Useraccounts]"
|
||||
call :dk_color %Blue% "Restart the system and try again."
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
@ -1460,7 +1458,7 @@ function ReinstallLicenses() {
|
|||
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@ -1524,7 +1522,7 @@ set pupfound=%pupfound1%%pupfound2%
|
|||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
if %hcount%==4 set "results=[AV URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
|
@ -1533,19 +1531,14 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
|
|||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
) || (
|
||||
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
)
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
|
||||
|
||||
if not "%results%%pupfound%"=="" (
|
||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||
if defined results call :dk_color %Red% "%results%"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%"
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
|
@ -1564,7 +1557,7 @@ call :dk_chkmal
|
|||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||
call :dk_color %Red% "Checking Sandboxing [Found. Script may not work properly.]"
|
||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
echo:
|
||||
)
|
||||
|
@ -1588,7 +1581,6 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
|
|||
|
||||
if defined serv_cor (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||
)
|
||||
|
||||
|
@ -1655,7 +1647,7 @@ if defined serv_e (
|
|||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Restart the system to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
@ -1695,7 +1687,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
|
|||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
@ -1705,8 +1697,8 @@ if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1734,7 +1726,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
|
|||
|
||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1805,7 +1797,7 @@ echo Checking Eval WLMS Service [Found]
|
|||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -1830,7 +1822,7 @@ set error=1
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
|
@ -1860,11 +1852,10 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||
%psc% "!d!" %nul%
|
||||
if exist "%tokenstore%\" (
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]"
|
||||
) else (
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1911,13 +1902,7 @@ for %%# in (
|
|||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||
if !errorlevel!==2 (
|
||||
if "%%A"=="%tokenstore%" (
|
||||
set "permerror=Error Found In Token Folder"
|
||||
) else (
|
||||
set "permerror=Error Found In SPP Registries"
|
||||
)
|
||||
)
|
||||
if !errorlevel!==2 set permerror=Error_Found
|
||||
)
|
||||
|
||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
|
@ -1980,7 +1965,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||
}
|
||||
for ($i=1; $i -le $count; $i++) {
|
||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||
Write-Output "Total Keys $count. Error Found - $i key does not exist."
|
||||
Write-Output "Total Keys $count. Error Found- $i key does not exist"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1991,7 +1976,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -1999,7 +1984,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
$subkey = $wpaKey.OpenSubKey($_)
|
||||
$p = $subkey.GetValueNames()
|
||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -2038,13 +2023,13 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %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 %_exitmsg%..."
|
||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
|
|
|
@ -52,7 +52,7 @@ set "_debug=0"
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
@ -191,13 +191,13 @@ call :dk_setvar
|
|||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo MAS only supports Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo Project is supported for Windows 7/8/8.1/10/11 and their Server equivalent.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
@ -217,8 +217,8 @@ setlocal EnableDelayedExpansion
|
|||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo Script is launched from the temp folder,
|
||||
echo Most likely you are running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto dk_done
|
||||
|
@ -259,7 +259,7 @@ goto dk_done
|
|||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
|
@ -312,20 +312,20 @@ set -=
|
|||
set old=
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo Version %masver% of MAS is outdated.
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
|
@ -385,7 +385,7 @@ echo [9] Download Office
|
|||
echo [0] %_exitmsg%
|
||||
echo ______________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,5,6,7,8,9,0]"
|
||||
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,3,4,5,6,7,8,9,0]"
|
||||
choice /C:1234567890 /N
|
||||
set _el=!errorlevel!
|
||||
|
||||
|
@ -420,7 +420,7 @@ call :dk_chkmal
|
|||
|
||||
if not exist %SysPath%\sppsvc.exe (
|
||||
%eline%
|
||||
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
||||
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -452,7 +452,7 @@ call :dk_showosinfo
|
|||
|
||||
set _int=
|
||||
for %%a in (l.root-servers.net resolver1.opendns.com download.windowsupdate.com google.com) do if not defined _int (
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not "%%#"=="" set _int=1)
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not [%%#]==[] set _int=1)
|
||||
)
|
||||
|
||||
if not defined _int (
|
||||
|
@ -508,13 +508,13 @@ if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*EvalCorEditio
|
|||
|
||||
if defined _eval (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% && (
|
||||
call :dk_color %Red% "Checking Evaluation Edition [Evaluation editions cannot be activated outside of evaluation period.]"
|
||||
call :dk_color %Red% "Checking Eval Edition [Evaluation Editions cannot be activated outside of evaluation period.]"
|
||||
|
||||
if defined _evalserv (
|
||||
call :dk_color %Blue% "Go back to main menu and use [Change Edition] option."
|
||||
) else (
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
)
|
||||
|
||||
goto :ks_office
|
||||
|
@ -546,7 +546,7 @@ set /a UBR=0
|
|||
if %osSKU%==191 if defined altkey if defined altedition (
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
|
||||
if %winbuild% LSS 22598 if !UBR! LSS 2788 (
|
||||
call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for IotEnterpriseS %KS% activation."
|
||||
call :dk_color %Blue% "Windows must to be updated to build 19044.2788 or higher for IotEnterpriseS %KS% activation."
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -557,11 +557,11 @@ call :dk_color %Red% "Checking Alternate Edition For %KS% [%altedition% Act
|
|||
if not defined key if not defined _gvlk (
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support %KS% activation.
|
||||
echo This product does not support %KS% Activation.
|
||||
set fixes=%fixes% %mas%unsupported_products_activation
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation"
|
||||
) else (
|
||||
echo Required license files not found in %SysPath%\spp\tokens\skus\
|
||||
echo Required License files not found in %SysPath%\spp\tokens\skus\
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -574,7 +574,7 @@ goto :ks_office
|
|||
:: Install key
|
||||
|
||||
if defined changekey (
|
||||
call :dk_color %Blue% "[%altedition%] edition product key will be used to enable %KS% activation."
|
||||
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable %KS% activation."
|
||||
echo:
|
||||
)
|
||||
|
||||
|
@ -602,28 +602,6 @@ if not %_actoff%==1 goto :ks_activate
|
|||
|
||||
call :ks_setspp
|
||||
|
||||
:: Check ohook install
|
||||
|
||||
set ohook=
|
||||
for %%# in (15 16) do (
|
||||
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
|
||||
if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set ohook=1
|
||||
)
|
||||
)
|
||||
|
||||
for %%# in (System SystemX86) do (
|
||||
for %%G in ("Office 15" "Office") do (
|
||||
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
|
||||
if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" set ohook=1
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined ohook (
|
||||
echo:
|
||||
call :dk_color %Gray% "Checking Ohook [Ohook activation is already installed for Office]"
|
||||
)
|
||||
|
||||
:: Check unsupported office versions
|
||||
|
||||
set o14c2r=
|
||||
|
@ -829,25 +807,9 @@ call :_taskregserv
|
|||
call :_taskact
|
||||
if not defined showfix if defined _tserror (call :dk_color %Blue% "%_fixmsg%" & set showfix=1)
|
||||
|
||||
:: Don't create renewal task if Windows/Office volume IDs are not found, even if script is set to create it by default
|
||||
:: Don't create renewal task if only Windows volume ID is found and OEM BIOS error is present on Windows 7, even if script is set to create it by default
|
||||
|
||||
set _deltask=
|
||||
if not %_norentsk%==0 set _deltask=1
|
||||
if not defined _deltask (
|
||||
if %_actwin%==0 call :_taskgetids sppwid %slp% windows
|
||||
if %_actoff%==0 call :_taskgetids sppoid %slp% office
|
||||
if %_actoff%==0 call :_taskgetids osppid %ospp% office
|
||||
)
|
||||
|
||||
if not defined sppwid if not defined sppoid if not defined osppid (set _deltask=1)
|
||||
if defined oemerr if not defined sppoid if not defined osppid (set _deltask=1)
|
||||
|
||||
if not defined _deltask (
|
||||
if %_norentsk%==0 (
|
||||
call :ks_renewal
|
||||
) else (
|
||||
if exist "%ProgramFiles%\Activation-Renewal\Activation_task.cmd" call :dk_color %Gray% "Deleting activation renewal task..."
|
||||
call :dk_color %Gray% "Skipping creation of activation renewal task..."
|
||||
call :ks_clearstuff %nul%
|
||||
if not defined _server (
|
||||
if %winbuild% GEQ 9200 (
|
||||
|
@ -873,11 +835,6 @@ if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# (
|
|||
call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
|
||||
)
|
||||
|
||||
if %_actoff%==1 if defined sppoid if not defined _tserror if %_NoEditionChange%==0 if defined ohub (
|
||||
echo:
|
||||
call :dk_color %Gray% "Office apps such as Word, Excel are activated, use them directly. Ignore 'Buy' button in Office dashboard app."
|
||||
)
|
||||
|
||||
:: Trigger reevaluation of SPP's Scheduled Tasks
|
||||
|
||||
call :dk_reeval %nul%
|
||||
|
@ -1079,7 +1036,7 @@ set _prod=!_altoffid!
|
|||
call :ks_osppready
|
||||
)
|
||||
|
||||
if not "!key!"=="" (
|
||||
if not [!key!]==[] (
|
||||
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
||||
call :dk_inskey "[!key!] [!_prod!]"
|
||||
) else (
|
||||
|
@ -1119,8 +1076,8 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\ProductVersion /v LastPr
|
|||
if "%_oRoot:~-1%"=="\" set "_oRoot=%_oRoot:~0,-1%"
|
||||
|
||||
echo "%2" | find /i "Wow6432Node" %nul1% && set _oArch=x86
|
||||
if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64
|
||||
if "%osarch%"=="x86" set _oArch=x86
|
||||
if not [%osarch%]==[x86] if not defined _oArch set _oArch=x64
|
||||
if [%osarch%]==[x86] set _oArch=x86
|
||||
|
||||
set "_common=%CommonProgramFiles%"
|
||||
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
|
||||
|
@ -1288,10 +1245,8 @@ reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f /reg:32 %nul%
|
|||
)
|
||||
|
||||
reg delete "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
|
||||
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
|
||||
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul%
|
||||
|
||||
echo Clearing Office License Blocks [Successfully cleared from all %counter% user accounts]
|
||||
echo Clearing Office License Blocks [Successfully Cleared From All %counter% Useraccounts]
|
||||
|
||||
::==========================
|
||||
|
||||
|
@ -1309,7 +1264,7 @@ for %%# in (%_sidlist%) do (
|
|||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
echo Adding Reg Keys To Skip License Check [Successfully Added To All %counter% ^& Future New Useraccounts]
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1323,14 +1278,14 @@ reg query HKU\%%# %nul% && set failedtounload=1
|
|||
|
||||
if defined failedtoload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Restart your system and try again."
|
||||
call :dk_color %Red% "Loading Unloaded accounts Registry [Failed For Some Useraccounts]"
|
||||
call :dk_color %Blue% "Restart the system and try again."
|
||||
)
|
||||
|
||||
if defined failedtounload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Restart your system and try again."
|
||||
call :dk_color %Red% "Unloading loaded accounts Registry [Failed For Some Useraccounts]"
|
||||
call :dk_color %Blue% "Restart the system and try again."
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
@ -1542,7 +1497,7 @@ set t_name=Run Once Task
|
|||
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
||||
)
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
|
@ -1567,12 +1522,12 @@ call :_tasksetserv
|
|||
|
||||
for %%a in (%srvlist%) do (
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (
|
||||
if not "%%#"=="" goto _taskIntConnected
|
||||
if not [%%#]==[] goto _taskIntConnected
|
||||
)
|
||||
)
|
||||
|
||||
nslookup dns.msftncsi.com 2>nul | find "131.107.255.255" 1>nul
|
||||
if "%errorlevel%"=="0" goto _taskIntConnected
|
||||
if [%errorlevel%]==[0] goto _taskIntConnected
|
||||
|
||||
if %loop%==%max_loop% (
|
||||
set _tserror=1
|
||||
|
@ -1683,14 +1638,14 @@ set /a act_attempt=0
|
|||
|
||||
if %act_attempt% GTR 4 exit /b
|
||||
|
||||
if not "%act_ok%"=="1" (
|
||||
if not [%act_ok%]==[1] (
|
||||
if not defined _server call :_taskgetserv
|
||||
call :_taskregserv
|
||||
)
|
||||
|
||||
if not !server_num! GTR %max_servers% (
|
||||
|
||||
if "%1"=="act_win" if %_kms38% EQU 1 (
|
||||
if [%1]==[act_win] if %_kms38% EQU 1 (
|
||||
set act_ok=1
|
||||
exit /b
|
||||
)
|
||||
|
@ -1704,7 +1659,7 @@ if !errorcode! EQU 0 (
|
|||
set act_ok=1
|
||||
exit /b
|
||||
)
|
||||
if "%1"=="act_win" if !errorcode! EQU -1073418187 if %winbuild% LSS 9200 (
|
||||
if [%1]==[act_win] if !errorcode! EQU -1073418187 if %winbuild% LSS 9200 (
|
||||
set act_ok=1
|
||||
exit /b
|
||||
)
|
||||
|
@ -1719,9 +1674,9 @@ exit /b
|
|||
|
||||
:_actinfo
|
||||
|
||||
if "%1"=="act_win" if not defined t_name (set prodname=%winos%)
|
||||
if [%1]==[act_win] if not defined t_name (set prodname=%winos%)
|
||||
|
||||
if "%1"=="act_win" if %_kms38% EQU 1 (
|
||||
if [%1]==[act_win] if %_kms38% EQU 1 (
|
||||
if defined t_name (
|
||||
echo %prodname% is already activated with KMS38.
|
||||
) else (
|
||||
|
@ -1741,7 +1696,7 @@ set _tserror=1
|
|||
exit /b
|
||||
)
|
||||
|
||||
if %errorcode% EQU -1073418187 if "%1"=="act_win" if %winbuild% LSS 9200 (
|
||||
if %errorcode% EQU -1073418187 if [%1]==[act_win] if %winbuild% LSS 9200 (
|
||||
if defined t_name (
|
||||
echo %prodname% cannot be KMS-activated on this computer due to unqualified OEM BIOS [0xC004F035].
|
||||
) else (
|
||||
|
@ -1749,7 +1704,6 @@ call :dk_color %Red% "%prodname% cannot be KMS-activated on this computer due to
|
|||
set fixes=%fixes% %mas%unsupported_products_activation
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation"
|
||||
)
|
||||
set oemerr=1
|
||||
set showfix=1
|
||||
exit /b
|
||||
)
|
||||
|
@ -1786,9 +1740,9 @@ exit /b
|
|||
)
|
||||
|
||||
set _actpass=1
|
||||
if %gpr% EQU 43200 if "%1"=="act_win" if %winbuild% GEQ 9200 set _actpass=0
|
||||
if %gpr% EQU 43200 if [%1]==[act_win] if %winbuild% GEQ 9200 set _actpass=0
|
||||
if %gpr% EQU 64800 set _actpass=0
|
||||
if %gpr% GTR 259200 if "%1"=="act_win" call :_taskchkEnterpriseG _actpass
|
||||
if %gpr% GTR 259200 if [%1]==[act_win] call :_taskchkEnterpriseG _actpass
|
||||
if %gpr% EQU 259200 set _actpass=0
|
||||
|
||||
if %errorcode% EQU 0 if %_actpass% EQU 0 (
|
||||
|
@ -1992,8 +1946,8 @@ set !server%rand%!=1
|
|||
|
||||
set /a server_num+=1
|
||||
(for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %KMS_IP% 2^>nul') do set "KMS_IP=%%a"
|
||||
if "%KMS_IP%"=="!KMS_IP!" for /f "delims=[] tokens=2" %%# in ('pathping -4 -h 1 -n -p 1 -q 1 -w 1 %KMS_IP% 2^>nul') do set "KMS_IP=%%#"
|
||||
if not "%KMS_IP%"=="!KMS_IP!" exit /b
|
||||
if [%KMS_IP%]==[!KMS_IP!] for /f "delims=[] tokens=2" %%# in ('pathping -4 -h 1 -n -p 1 -q 1 -w 1 %KMS_IP% 2^>nul') do set "KMS_IP=%%#"
|
||||
if not [%KMS_IP%]==[!KMS_IP!] exit /b
|
||||
goto :_taskgetserv
|
||||
)
|
||||
::Ver:2.7
|
||||
|
@ -2448,7 +2402,7 @@ function ReinstallLicenses() {
|
|||
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@ -2548,7 +2502,7 @@ for %%# in (pkeyhelper.dll) do @if "%%~$PATH:#"=="" exit /b
|
|||
for %%# in (Volume:GVLK) do (
|
||||
call :k_pkey %osSKU% '%%#'
|
||||
if defined pkey call :k_pkeychannel !pkey!
|
||||
if /i "!pkeychannel!"=="%%#" (
|
||||
if /i [!pkeychannel!]==[%%#] (
|
||||
set key=!pkey!
|
||||
exit /b
|
||||
)
|
||||
|
@ -2573,7 +2527,7 @@ set pupfound=%pupfound1%%pupfound2%
|
|||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
if %hcount%==4 set "results=[AV URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
|
@ -2582,19 +2536,14 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
|
|||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
) || (
|
||||
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||
)
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
|
||||
|
||||
if not "%results%%pupfound%"=="" (
|
||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||
if defined results call :dk_color %Red% "%results%"
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%"
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
|
@ -2613,7 +2562,7 @@ call :dk_chkmal
|
|||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||
call :dk_color %Red% "Checking Sandboxing [Found. Script may not work properly.]"
|
||||
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
echo:
|
||||
)
|
||||
|
@ -2637,7 +2586,6 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
|
|||
|
||||
if defined serv_cor (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||
)
|
||||
|
||||
|
@ -2704,7 +2652,7 @@ if defined serv_e (
|
|||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Restart the system to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
@ -2744,7 +2692,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
|
|||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
set error=1
|
||||
set wpaerror=1
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
@ -2754,8 +2702,8 @@ if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
set fixes=%fixes% %mas%evaluation-editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation-editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -2783,7 +2731,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
|
|||
|
||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -2854,7 +2802,7 @@ echo Checking Eval WLMS Service [Found]
|
|||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
@ -2879,7 +2827,7 @@ set error=1
|
|||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
|
@ -2909,11 +2857,10 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||
%psc% "!d!" %nul%
|
||||
if exist "%tokenstore%\" (
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]"
|
||||
) else (
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -2960,13 +2907,7 @@ for %%# in (
|
|||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||
if !errorlevel!==2 (
|
||||
if "%%A"=="%tokenstore%" (
|
||||
set "permerror=Error Found In Token Folder"
|
||||
) else (
|
||||
set "permerror=Error Found In SPP Registries"
|
||||
)
|
||||
)
|
||||
if !errorlevel!==2 set permerror=Error_Found
|
||||
)
|
||||
|
||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
|
@ -3029,7 +2970,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||
}
|
||||
for ($i=1; $i -le $count; $i++) {
|
||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||
Write-Output "Total Keys $count. Error Found - $i key does not exist."
|
||||
Write-Output "Total Keys $count. Error Found- $i key does not exist"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -3040,7 +2981,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -3048,7 +2989,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||
$subkey = $wpaKey.OpenSubKey($_)
|
||||
$p = $subkey.GetValueNames()
|
||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
|
@ -3087,13 +3028,13 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %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 %_exitmsg%..."
|
||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
|
|
|
@ -19,7 +19,7 @@ set _stg=0
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
@ -127,13 +127,13 @@ set "line=echo _________________________________________________________________
|
|||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
@ -153,8 +153,8 @@ setlocal EnableDelayedExpansion
|
|||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo Script is launched from the temp folder,
|
||||
echo Most likely you are running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto dk_done
|
||||
|
@ -195,7 +195,7 @@ goto dk_done
|
|||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
|
@ -248,20 +248,20 @@ set -=
|
|||
set old=
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo Version %masver% of MAS is outdated.
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
|
@ -280,7 +280,7 @@ if not defined desktop for /f "delims=" %%a in ('%psc% "& {write-host $([Environ
|
|||
|
||||
if not defined desktop (
|
||||
%eline%
|
||||
echo Unable to detect Desktop location, aborting...
|
||||
echo Desktop location was not detected, aborting...
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
|
@ -302,7 +302,7 @@ dism.exe
|
|||
) do (
|
||||
if not exist %SysPath%\%%# (
|
||||
%eline%
|
||||
echo [%SysPath%\%%#] file is missing, aborting...
|
||||
echo [%SysPath%\%%#] file is missing. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -335,7 +335,7 @@ if defined UBR (set "fullbuild=%%G.!UBR!") else (set "fullbuild=%%G.%%H")
|
|||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%eline%
|
||||
echo Either key is not insalled or script failed to get installed key's activation ID. Aborting...
|
||||
echo Either key is not insalled or failed to get installed key activation ID. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -356,7 +356,7 @@ if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
|
|||
|
||||
if %osedition%==0 (
|
||||
%eline%
|
||||
echo Failed to detect OS edition, aborting...
|
||||
echo Failed to detect OS Edition. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -376,7 +376,7 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Get target editions list
|
||||
:: Get Target editions list
|
||||
|
||||
set _target=
|
||||
set _dtarget=
|
||||
|
@ -403,9 +403,9 @@ call :dk_color %Red% "==== Note ===="
|
|||
echo:
|
||||
echo [EditionID:%osedition% ^| %fullbuild%]
|
||||
echo:
|
||||
echo Changing this edition may not remove "%osedition%"-specific features.
|
||||
echo Changing this edition to any other may not remove "%osedition%" specific features.
|
||||
echo:
|
||||
call :dk_color %_Yellow% "Press [7] to continue anyway..."
|
||||
call :dk_color %_Yellow% "Press 7 key to continue..."
|
||||
choice /c 7 /n
|
||||
cls
|
||||
)
|
||||
|
@ -424,7 +424,7 @@ if not defined _ntarget (
|
|||
%line%
|
||||
echo:
|
||||
if defined dismnotworking call :dk_color %Red% "DISM.exe is not working."
|
||||
call :dk_color %Gray% "Target editions not found."
|
||||
call :dk_color %Gray% "Target Edition not found."
|
||||
echo Current Edition [%osedition% ^| %winbuild%] can not be changed to any other Edition.
|
||||
%line%
|
||||
goto dk_done
|
||||
|
@ -443,7 +443,7 @@ set targetedition=
|
|||
|
||||
%line%
|
||||
echo:
|
||||
call :dk_color %Gray% "You can change the edition [%osedition%] [%fullbuild%] to one of the following."
|
||||
call :dk_color %Gray% "You can change the Edition [%osedition%] [%fullbuild%] to one of the following."
|
||||
%showeditionerror%
|
||||
if defined dismnotworking (
|
||||
call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
||||
|
@ -462,7 +462,7 @@ set targetedition!counter!=%%A
|
|||
echo:
|
||||
echo [0] %_exitmsg%
|
||||
echo:
|
||||
call :dk_color %_Green% "Enter an option number using your keyboard and press Enter to confirm:"
|
||||
call :dk_color %_Green% "Enter option number in keyboard, and press "Enter":"
|
||||
set /p inpt=
|
||||
if "%inpt%"=="" goto cedmenu2
|
||||
if "%inpt%"=="0" exit /b
|
||||
|
@ -483,12 +483,12 @@ echo:
|
|||
call :dk_color %Red% "==== Note ===="
|
||||
echo:
|
||||
echo Once the edition is changed to "%targetedition%",
|
||||
echo the system may not be able to properly change edition later.
|
||||
echo system may not be able to properly change edition to any other later.
|
||||
echo:
|
||||
echo [1] Continue Anyway
|
||||
echo [1] Continue
|
||||
echo [0] Go Back
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 goto cedmenu2
|
||||
if !errorlevel!==1 rem
|
||||
|
@ -499,7 +499,7 @@ set key=
|
|||
set _chan=
|
||||
set _dismapi=0
|
||||
|
||||
:: Check if DISM API or slmgr.vbs is required for edition upgrade
|
||||
:: Check if DISM Api or slmgr.vbs is required for edition upgrade
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" (
|
||||
echo %_wtarget% | find /i " %targetedition% " || (
|
||||
|
@ -521,7 +521,7 @@ set _chan=Retail
|
|||
if not defined key (
|
||||
%eline%
|
||||
echo [%targetedition% ^| %winbuild%]
|
||||
echo Failed to get product key from pkeyhelper.dll.
|
||||
echo Unable to get product key from pkeyhelper.dll
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -544,13 +544,13 @@ cls
|
|||
echo:
|
||||
%showeditionerror%
|
||||
if defined dismnotworking call :dk_color %_Yellow% "DISM.exe is not working."
|
||||
echo Changing the current edition [%osedition%] %fullbuild% to [%targetedition%]...
|
||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
||||
echo:
|
||||
|
||||
if %_dismapi%==1 (
|
||||
call :dk_color %Green% "Notes -"
|
||||
call :dk_color %Green% "Notes-"
|
||||
echo:
|
||||
echo - Save your work before continuing, the system will auto-restart.
|
||||
echo - Save your work before continue, system will auto restart.
|
||||
echo:
|
||||
echo - You will need to activate with HWID option once the edition is changed.
|
||||
%line%
|
||||
|
@ -562,7 +562,7 @@ if !errorlevel!==1 exit /b
|
|||
::========================================================================================================================================
|
||||
|
||||
if %_dismapi%==0 (
|
||||
echo Installing %_chan% key [%key%]
|
||||
echo Installing %_chan% Key [%key%]
|
||||
echo:
|
||||
if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul%
|
||||
if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||
|
@ -574,7 +574,7 @@ if !keyerror! EQU 0 (
|
|||
call :dk_refresh
|
||||
call :dk_color %Green% "[Successful]"
|
||||
echo:
|
||||
call :dk_color %Gray% "Reboot is required to fully change the edition."
|
||||
call :dk_color %Gray% "Reboot is required to properly change the Edition."
|
||||
) else (
|
||||
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
|
||||
echo:
|
||||
|
@ -585,7 +585,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
|||
|
||||
if %_dismapi%==1 (
|
||||
echo:
|
||||
echo Applying the DISM API method with %_chan% key %key%. Please wait...
|
||||
echo Applying the DISM API method with %_chan% Key %key%. Please wait...
|
||||
echo:
|
||||
|
||||
call :ced_prep
|
||||
|
@ -614,9 +614,9 @@ if defined rebootreq goto dk_done
|
|||
echo:
|
||||
%showeditionerror%
|
||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
||||
echo Changing the current edition [%osedition%] %fullbuild% to [%targetedition%]...
|
||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
||||
echo:
|
||||
call :dk_color %Blue% "Important - Save your work before continuing, the system will auto-restart."
|
||||
call :dk_color %Blue% "Important - Save your work before continue, system will auto reboot."
|
||||
echo:
|
||||
choice /C:01 /N /M "[1] Continue [0] %_exitmsg% : "
|
||||
if %errorlevel%==1 exit /b
|
||||
|
@ -657,7 +657,7 @@ if not defined key call :changeeditiondata
|
|||
if not defined key (
|
||||
%eline%
|
||||
echo [%targetedition% ^| %winbuild%]
|
||||
echo Failed to get product key from pkeyhelper.dll.
|
||||
echo Unable to get product key from pkeyhelper.dll
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -671,13 +671,13 @@ cls
|
|||
echo:
|
||||
%showeditionerror%
|
||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not working."
|
||||
echo Changing the current edition [%osedition%] %fullbuild% to [%targetedition%]...
|
||||
echo Changing the Current Edition [%osedition%] %fullbuild% to [%targetedition%]
|
||||
echo:
|
||||
|
||||
call :ced_prep
|
||||
if defined preperror goto dk_done
|
||||
|
||||
echo Applying the command with %_chan% key...
|
||||
echo Applying the command with %_chan% Key
|
||||
echo DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
|
||||
DISM /online /Set-Edition:%targetedition% /ProductKey:%key% /AcceptEula
|
||||
|
||||
|
@ -699,8 +699,8 @@ for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time
|
|||
|
||||
sc query TrustedInstaller | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Failed to stop the TrustedInstaller service.
|
||||
echo Restart your system and try again.
|
||||
echo Failed to stop TrustedInstaller service.
|
||||
echo Try again or Restart your system and then try again.
|
||||
set preperror=1
|
||||
exit /b
|
||||
)
|
||||
|
@ -731,9 +731,9 @@ call :compresslog DISM\dism_%_time%.log ChangeEdition_Logs\DISM %nul%
|
|||
|
||||
echo:
|
||||
if %winbuild% GEQ 9200 %psc% "if ((Get-WindowsOptionalFeature -Online -FeatureName NetFx3).State -eq 'Enabled') {Write-Host 'Checking .NET Framework 3.5 Status - Enabled'}"
|
||||
echo Log files are copied to the ChangeEdition_Logs folder on your desktop.
|
||||
echo Log files are copied to the ChangeEdition_Logs folder on the desktop.
|
||||
echo:
|
||||
call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
|
||||
call :dk_color %Blue% "In case of errors, restart system before trying again."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%change_edition_issues
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
|
||||
|
@ -850,7 +850,7 @@ exit /b
|
|||
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@ -891,7 +891,7 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Upd
|
|||
|
||||
if defined rebootreq (
|
||||
%eline%
|
||||
echo Pending reboot flags found.
|
||||
echo Pending Reboot flags found.
|
||||
echo:
|
||||
echo Make sure Windows is fully updated, restart the system and try again.
|
||||
)
|
||||
|
@ -935,7 +935,7 @@ for %%# in (pkeyhelper.dll) do @if "%%~$PATH:#"=="" exit /b
|
|||
for %%# in (%keyflow%) do (
|
||||
call :k_pkey %targetSKU% '%%#'
|
||||
if defined pkey call :k_pkeychannel !pkey!
|
||||
if /i "!pkeychannel!"=="%%#" (
|
||||
if /i [!pkeychannel!]==[%%#] (
|
||||
set key=!pkey!
|
||||
exit /b
|
||||
)
|
||||
|
@ -987,13 +987,13 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %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 %_exitmsg%..."
|
||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
File diff suppressed because it is too large
Load Diff
|
@ -6,23 +6,10 @@
|
|||
:: https://gravesoft.dev/cas
|
||||
|
||||
|
||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
||||
set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
|
||||
|
||||
set "SysPath=%SystemRoot%\System32"
|
||||
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||
set "SysPath=%SystemRoot%\Sysnative"
|
||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||
)
|
||||
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set "_psc=powershell -nop -c"
|
||||
set "_err===== ERROR ===="
|
||||
set _pwsh=1
|
||||
|
@ -42,8 +29,8 @@ setlocal EnableDelayedExpansion
|
|||
|
||||
:E_Exit
|
||||
echo.
|
||||
echo Press 0 key to exit.
|
||||
choice /c 0 /n
|
||||
echo Press any key to exit.
|
||||
pause >nul
|
||||
exit /b
|
||||
|
||||
:sppmgr:
|
|
@ -1,12 +1,15 @@
|
|||
@set masver=2.6
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Email: mas.help@outlook.com
|
||||
:: Email: windowsaddict@protonmail.com
|
||||
::
|
||||
::============================================================================
|
||||
|
||||
|
@ -14,31 +17,25 @@
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
:: Set Path variable, it helps if it is misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
||||
set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
|
||||
|
||||
set "SysPath=%SystemRoot%\System32"
|
||||
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||
set "PATH=%SystemRoot%\System32;%SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||
set "SysPath=%SystemRoot%\Sysnative"
|
||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||
set "PATH=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%PATH%"
|
||||
)
|
||||
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="-qedit" (
|
||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d "1" /f %nul1%
|
||||
rem check the code below admin elevation to understand why it's here
|
||||
)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
|
@ -67,10 +64,10 @@ echo:
|
|||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Help - %mas%troubleshoot.html
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
ping 127.0.0.1 -n 10
|
||||
)
|
||||
cls
|
||||
|
||||
|
@ -79,13 +76,9 @@ cls
|
|||
pushd "%~dp0"
|
||||
>nul findstr /v "$" "%~nx0" && (
|
||||
echo:
|
||||
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
ping 127.0.0.1 -n 6 >nul
|
||||
popd
|
||||
exit /b
|
||||
)
|
||||
|
@ -95,11 +88,10 @@ popd
|
|||
|
||||
cls
|
||||
color 07
|
||||
title Extract $OEM$ Folder %masver%
|
||||
title Extract $OEM$ Folder %masver%
|
||||
|
||||
set _args=
|
||||
set _elev=
|
||||
set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
|
@ -114,20 +106,54 @@ set "nul2=2>nul"
|
|||
set "nul6=2^>nul"
|
||||
set "nul=>nul 2>&1"
|
||||
|
||||
call :dk_setvar
|
||||
set psc=powershell.exe
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
set "_Yellow="40;93m""
|
||||
) else (
|
||||
set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
set "_Yellow="Black" "Yellow""
|
||||
)
|
||||
|
||||
set "nceline=echo: &echo ==== ERROR ==== &echo:"
|
||||
set "eline=echo: &call :ex_color %Red% "==== ERROR ====" &echo:"
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent.
|
||||
goto done2
|
||||
)
|
||||
|
||||
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" (
|
||||
%nceline%
|
||||
echo Unable to find powershell.exe in the system.
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
@ -136,8 +162,6 @@ set "_batf=%~f0"
|
|||
set "_batp=%_batf:'=''%"
|
||||
|
||||
set _PSarg="""%~f0""" -el %_args%
|
||||
set _PSarg=%_PSarg:'=''%
|
||||
|
||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
|
@ -147,8 +171,8 @@ setlocal EnableDelayedExpansion
|
|||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo Script is launched from the temp folder,
|
||||
echo Most likely you are running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto done2
|
||||
|
@ -157,83 +181,30 @@ goto done2
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
|
||||
|
||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||
%eline%
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
||||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
) || (
|
||||
echo PowerShell is not working. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell"
|
||||
)
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
:: This code disables QuickEdit for this cmd.exe session only without making permanent changes to the registry
|
||||
:: It is added because clicking on the script window pauses the operation and leads to the confusion that script stopped due to an error
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
set terminal=1
|
||||
) else (
|
||||
set terminal=
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" set quedit=1)
|
||||
|
||||
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% || if not defined quedit (
|
||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d "0" /f %nul1%
|
||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||
rem quickedit reset code is added at the starting of the script instead of here because it takes time to reflect in some cases
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Check if script is running in Terminal app
|
||||
|
||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128);
|
||||
set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128);
|
||||
set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow();
|
||||
set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero);
|
||||
|
||||
if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
if defined terminal (
|
||||
set "launchcmd=start conhost.exe %psc%"
|
||||
) else (
|
||||
set "launchcmd=%psc%"
|
||||
)
|
||||
|
||||
:: Disable QuickEdit in current session
|
||||
|
||||
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
|
||||
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
|
||||
|
||||
%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1)
|
||||
:skipQE
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check for updates
|
||||
|
@ -242,25 +213,24 @@ set -=
|
|||
set old=
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo You are running outdated version MAS %masver%
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
call :ex_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
cls
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
|
@ -277,7 +247,7 @@ set "_dir=%desktop%\$OEM$\$$\Setup\Scripts"
|
|||
|
||||
if exist "!desktop!\" (
|
||||
%eline%
|
||||
echo Unable to detect Desktop location, aborting...
|
||||
echo Desktop location was not detected, aborting...
|
||||
goto done2
|
||||
)
|
||||
|
||||
|
@ -285,12 +255,12 @@ setlocal EnableDelayedExpansion
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
if not defined terminal mode 78, 30
|
||||
mode con cols=78 lines=30
|
||||
|
||||
if exist "!desktop!\$OEM$\" (
|
||||
echo _____________________________________________________
|
||||
%eline%
|
||||
echo The $OEM$ folder already exists on your Desktop.
|
||||
echo $OEM$ folder already exists on the Desktop.
|
||||
echo _____________________________________________________
|
||||
goto done2
|
||||
)
|
||||
|
@ -326,7 +296,7 @@ goto done2
|
|||
:Menu
|
||||
|
||||
cls
|
||||
if not defined terminal mode 78, 30
|
||||
mode con cols=78 lines=30
|
||||
echo:
|
||||
echo:
|
||||
echo:
|
||||
|
@ -345,16 +315,16 @@ echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^)
|
|||
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
|
||||
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo:
|
||||
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
call :ex_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
echo: [0] Exit
|
||||
echo: ________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
|
||||
call :ex_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard :"
|
||||
choice /C:123456789R0 /N
|
||||
set _erl=%errorlevel%
|
||||
|
||||
if %_erl%==11 exit /b
|
||||
if %_erl%==10 start %mas%oem-folder &goto :Menu
|
||||
if %_erl%==10 start %mas%oem-folder.html &goto :Menu
|
||||
if %_erl%==9 goto:kms_ohook
|
||||
if %_erl%==8 goto:kms38_kms
|
||||
if %_erl%==7 goto:kms38_ohook
|
||||
|
@ -480,7 +450,7 @@ goto done
|
|||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-WindowsOffice
|
||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-WindowsOffice
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
|
@ -555,7 +525,7 @@ call "%~dp0HWID_Activation.cmd" /HWID
|
|||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Office
|
||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
|
@ -631,7 +601,7 @@ call "%~dp0KMS38_Activation.cmd" /KMS38
|
|||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Office
|
||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
|
@ -665,7 +635,7 @@ goto done
|
|||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Windows
|
||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Windows
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
|
@ -681,15 +651,15 @@ cd \
|
|||
:errorfound
|
||||
|
||||
%eline%
|
||||
echo The script failed to create the $OEM$ folder.
|
||||
echo $OEM$ Folder was not created successfully...
|
||||
goto :done2
|
||||
|
||||
:done
|
||||
|
||||
echo ______________________________________________________________
|
||||
echo:
|
||||
call :dk_color %Blue% "%oem%"
|
||||
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
|
||||
call :ex_color %Blue% "%oem%"
|
||||
call :ex_color %Green% "$OEM$ folder is successfully created on the Desktop."
|
||||
echo "%oem%" | find /i "38" %nul% && (
|
||||
echo:
|
||||
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
|
||||
|
@ -700,65 +670,8 @@ echo ______________________________________________________________
|
|||
:done2
|
||||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %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 %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
call :ex_color %_Yellow% "Press any key to exit..."
|
||||
pause %nul1%
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set variables
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
set "_Yellow="40;93m""
|
||||
) else (
|
||||
set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
set "_Yellow="Black" "Yellow""
|
||||
)
|
||||
|
||||
set "nceline=echo: &echo ==== ERROR ==== &echo:"
|
||||
set "eline=echo: &call :dk_color %Red% "==== ERROR ====" &echo:"
|
||||
if %~z0 GEQ 200000 (
|
||||
set "_exitmsg=Go back"
|
||||
set "_fixmsg=Go back to Main Menu, select Troubleshoot and run Fix Licensing option."
|
||||
) else (
|
||||
set "_exitmsg=Exit"
|
||||
set "_fixmsg=In MAS folder, run Troubleshoot script and select Fix Licensing option."
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -772,21 +685,21 @@ exit /b
|
|||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_color
|
||||
:ex_color
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
if not exist %psc% (echo %~3) else (%psc% write-host -back '%1' -fore '%2' '%3')
|
||||
)
|
||||
exit /b
|
||||
|
||||
:dk_color2
|
||||
:ex_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'
|
||||
if not exist %psc% (echo %~3%~6) else (%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6')
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue