mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-03-17 13:33:35 +00:00
Compare commits
109 Commits
ec31fef9b9
...
dev
Author | SHA1 | Date | |
---|---|---|---|
fe001e6c39 | |||
c4f33e96c4 | |||
69f1a206fb | |||
ab0cd24f89 | |||
55afa30fcd | |||
5e7e42a446 | |||
a9eda8f572 | |||
a5bcfdd3e6 | |||
8d67d62c15 | |||
6adb247334 | |||
6c8732dd06 | |||
9765e7d05f | |||
60c99742ce | |||
8f3f392517 | |||
af69d79c5c | |||
63045afc70 | |||
19c6612a47 | |||
9e6f386819 | |||
b5ba36c033 | |||
d10b6d691e | |||
de812acdc5 | |||
75c34cbf50 | |||
0d533338a1 | |||
411f387705 | |||
be44b2d887 | |||
0c88f6bc2c | |||
d31e4ab0cb | |||
9fd5a661ab | |||
b732e2c8d7 | |||
8e2677b1f9 | |||
f2e40bf88e | |||
a4f9b219ab | |||
7262a44ba2 | |||
37ec96504a | |||
051b4f673f | |||
3ef6d7292e | |||
0d9ffd2052 | |||
9f00df5aee | |||
d6aa8b97d1 | |||
c00b076a86 | |||
8fff2ccb9c | |||
5638898eaf | |||
22ed7a7a07 | |||
f1ddb83df0 | |||
4dd0215ccc | |||
ec259dfbd7 | |||
bbdc9bdfd8 | |||
7d036f57fd | |||
ab90514b0a | |||
25abc1f457 | |||
873c4bc4d8 | |||
0b402d9afe | |||
5141866f0a | |||
f0618824a4 | |||
03cc88193d | |||
897a9db808 | |||
9bbd02cc91 | |||
d1dca45710 | |||
5e71252993 | |||
1db017f1f1 | |||
d06ba7fc4c | |||
99954a9056 | |||
fcb710a48a | |||
0cbaa141c3 | |||
9d1964ceda | |||
0477cf13e1 | |||
9b568d4b4e | |||
1c9fe0815e | |||
a5dd99ac00 | |||
1849dd3075 | |||
8fe0b24945 | |||
7c69c471c5 | |||
f32cb934dc | |||
7a6e63a462 | |||
d76b2ea57e | |||
1f0e04519a | |||
d059952ecd | |||
6efb5d50fe | |||
b2831795a4 | |||
4e8ebecd3d | |||
d929cd8fa0 | |||
d384c5f2f7 | |||
643d4f077f | |||
db26b75b64 | |||
07ad5a208d | |||
b80a502086 | |||
104d0b0dda | |||
db218720f3 | |||
b8504cc21e | |||
2e6bfa94c2 | |||
a1244dcb3b | |||
06695612a8 | |||
323c6808af | |||
841d856a29 | |||
52d4c52dba | |||
c75cd29b9f | |||
b1b5299c47 | |||
652092e985 | |||
b06c83622a | |||
ce669809bf | |||
0afb09cbd1 | |||
5d8a463475 | |||
7044f37b44 | |||
08443039aa | |||
fd8b81411c | |||
213bc50b49 | |||
00e81be52f | |||
2443e1e471 | |||
35e044ddc8 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
# MAS export-ignore
|
||||
# LICENSE export-ignore
|
||||
# README.md export-ignore
|
||||
.gitattributes export-ignore
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@set masver=3.0
|
||||
@echo off
|
||||
|
||||
|
||||
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
@ -107,7 +109,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@ -122,7 +124,7 @@ echo:
|
||||
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 Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@ -143,6 +145,8 @@ set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/HWID" set _act=1
|
||||
@ -157,19 +161,29 @@ for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
|
||||
|
||||
call :dk_setvar
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 10240 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo HWID Activation is only supported on Windows 10/11.
|
||||
echo:
|
||||
call :dk_color %Blue% "Use Online KMS activation option."
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu."
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
%eline%
|
||||
echo HWID Activation is not supported on Windows Server.
|
||||
call :dk_color %Blue% "Use KMS38 or Online KMS activation option."
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu."
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -205,32 +219,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: 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 dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@ -243,6 +231,48 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
echo %tstresult%
|
||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
%eline%
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@ -263,6 +293,7 @@ if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
@ -288,9 +319,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@ -306,7 +347,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@ -332,7 +373,7 @@ if not exist %SysPath%\%%# (
|
||||
echo [%SysPath%\%%#] file is missing, aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
@ -357,7 +398,6 @@ cls
|
||||
echo ___________________________________________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
|
||||
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
||||
echo ___________________________________________________________________________________________
|
||||
if %_unattended%==1 goto dk_done
|
||||
echo:
|
||||
@ -375,10 +415,11 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2
|
||||
%eline%
|
||||
echo [%winos% ^| %winbuild%]
|
||||
echo:
|
||||
echo Evaluation editions cannot be activated outside of their evaluation period.
|
||||
echo Evaluation editions cannot be activated outside of their evaluation period.
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
@ -459,13 +500,13 @@ echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support HWID activation.
|
||||
echo Make sure you are using the latest version of the script.
|
||||
echo If you are, then try KMS38 activation option.
|
||||
echo If you are, then try TSforge activation option from the main menu.
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
) else (
|
||||
echo Required license files not found in %SysPath%\spp\tokens\skus\
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
echo:
|
||||
goto dk_done
|
||||
@ -537,14 +578,14 @@ echo Generating GenuineTicket.xml [Successful]
|
||||
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||
|
||||
%_xmlexist% (
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
|
||||
%_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 %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -599,17 +640,18 @@ goto :dl_final
|
||||
|
||||
set "_ident=HKU\S-1-5-19\SOFTWARE\Microsoft\IdentityCRL"
|
||||
|
||||
if defined _int (
|
||||
if %keyerror% EQU 0 if defined _int (
|
||||
reg delete "%_ident%" /f %nul%
|
||||
reg query "%_ident%" %nul% && (
|
||||
echo:
|
||||
set error=1
|
||||
call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]"
|
||||
)
|
||||
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
|
||||
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
|
||||
call :dk_refresh
|
||||
call :dk_act
|
||||
call :dk_checkperm
|
||||
|
||||
reg query "%_ident%" %nul% || (
|
||||
set error=1
|
||||
echo:
|
||||
call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%]"
|
||||
)
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
@ -617,79 +659,95 @@ call :dk_checkperm
|
||||
:: Extended licensing servers tests incase error not found and activation failed
|
||||
|
||||
if %keyerror% EQU 0 if not defined _perm if defined _int (
|
||||
set resfail=
|
||||
ipconfig /flushdns %nul%
|
||||
set "tls=[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;"
|
||||
|
||||
for %%# in (
|
||||
licensing.mp.microsoft.com/v7.0/licenses/content
|
||||
login.live.com/ppsecure/deviceaddcredential.srf
|
||||
purchase.mp.microsoft.com/v7.0/users/me/orders
|
||||
) do if not defined resfail (
|
||||
set "d1=Add-Type -AssemblyName System.Net.Http;"
|
||||
set "d1=!d1! $client = [System.Net.Http.HttpClient]::new();"
|
||||
set "d1=!d1! $response = $client.GetAsync('https://%%#').GetAwaiter().GetResult();"
|
||||
set "d1=!d1! $response.Content.ReadAsStringAsync().GetAwaiter().GetResult()"
|
||||
%psc% "!tls! !d1!" %nul2% | findstr /i "PurchaseFD DeviceAddResponse" %nul1% || set resfail=1
|
||||
%psc% "try { !tls! irm https://%%# -Method POST } catch { if ($_.Exception.Response -eq $null) { Write-Host """"[%%#] $($_.Exception.Message)"""" -ForegroundColor Red -BackgroundColor Black; exit 3 } }"
|
||||
if !errorlevel!==3 set resfail=1
|
||||
)
|
||||
|
||||
if not defined resfail (
|
||||
%psc% "!tls! irm https://licensing.mp.microsoft.com/v7.0/licenses/content -Method POST" | find /i "traceId" %nul1% || set resfail=1
|
||||
)
|
||||
|
||||
if defined resfail (
|
||||
set error=1
|
||||
echo:
|
||||
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]"
|
||||
for %%# in (
|
||||
live.com
|
||||
microsoft.com
|
||||
login.live.com
|
||||
purchase.mp.microsoft.com
|
||||
licensing.mp.microsoft.com
|
||||
) do (
|
||||
findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [%%# Blocked in Hosts]"
|
||||
)
|
||||
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]!hosfail!"
|
||||
set fixes=%fixes% %mas%licensing-servers-issue
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
|
||||
:: Windows update and store block check
|
||||
|
||||
if %keyerror% EQU 0 if not defined _perm if defined _int (
|
||||
|
||||
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess %nul2% | find /i "0x1" %nul% && set wublock=1
|
||||
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DoNotConnectToWindowsUpdateInternetLocations %nul2% | find /i "0x1" %nul% && set wublock=1
|
||||
if defined wublock (
|
||||
call :dk_color %Red% "Checking Update Blocker In Registry [Found]"
|
||||
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
|
||||
)
|
||||
|
||||
reg query "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v DisableStoreApps %nul2% | find /i "0x1" %nul% && (
|
||||
set storeblock=1
|
||||
call :dk_color %Red% "Checking Store Blocker In Registry [Found]"
|
||||
call :dk_color %Blue% "If you have used any tool to block Store, undo it."
|
||||
)
|
||||
|
||||
set wcount=0
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type ServiceSidType RequiredPrivileges FailureActions) do (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv /v %%G %nul% || (set wucorrupt=1&set /a wcount+=1)
|
||||
)
|
||||
|
||||
for %%G in (Parameters Security) do (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || (set wucorrupt=1&set /a wcount+=1)
|
||||
)
|
||||
|
||||
if defined wucorrupt (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
|
||||
if !wcount! GTR 2 (
|
||||
call :dk_color %Red% "Windows seems to be infected with Mal%w%ware."
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
) else (
|
||||
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
|
||||
)
|
||||
) else (
|
||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null"
|
||||
sc query wuauserv | find /i "RUNNING" %nul% || (
|
||||
set error=1
|
||||
set wuerror=1
|
||||
sc start wuauserv %nul%
|
||||
call :dk_color %Red% "Starting Windows Update Service [Failed] [!errorlevel!]"
|
||||
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
|
||||
:: Check Internet related error codes
|
||||
|
||||
if %keyerror% EQU 0 if not defined _perm if defined _int (
|
||||
|
||||
reg query "%_ident%" %nul% || (
|
||||
set error=1
|
||||
echo:
|
||||
call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%]"
|
||||
)
|
||||
|
||||
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess %nul2% | find /i "0x1" %nul% && set wublock=1
|
||||
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DoNotConnectToWindowsUpdateInternetLocations %nul2% | find /i "0x1" %nul% && set wublock=1
|
||||
if defined wublock call :dk_color %Red% "Checking Update Blocker In Registry [Found]"
|
||||
|
||||
reg query "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v DisableStoreApps %nul2% | find /i "0x1" %nul% && (
|
||||
set storeblock=1
|
||||
call :dk_color %Red% "Checking Store Blocker In Registry [Found]"
|
||||
)
|
||||
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type ServiceSidType RequiredPrivileges FailureActions) do if not defined wucorrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv /v %%G %nul% || set wucorrupt=1
|
||||
)
|
||||
|
||||
for %%G in (Parameters Security TriggerInfo) do if not defined wucorrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || set wucorrupt=1
|
||||
)
|
||||
|
||||
if defined wucorrupt (
|
||||
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
|
||||
) else (
|
||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 10 | Out-Null"
|
||||
sc query wuauserv | find /i "RUNNING" %nul% || (
|
||||
set wuerror=1
|
||||
sc start wuauserv %nul%
|
||||
call :dk_color %Red% "Starting Windows Update Service [Failed] [!errorlevel!]"
|
||||
)
|
||||
)
|
||||
|
||||
REM Check Internet related error codes
|
||||
|
||||
if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock (
|
||||
if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock if not defined resfail (
|
||||
echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && (
|
||||
call :dk_color %Red% "Checking Internet Issues [Found] %error_code%"
|
||||
set fixes=%fixes% %mas%licensing-servers-issue
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -703,11 +761,11 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
|
||||
call :dk_color %Red% "Activation Failed %error_code%"
|
||||
if defined notworking (
|
||||
call :dk_color %Blue% "At the time of writing, HWID Activation is not supported for this product."
|
||||
call :dk_color %Blue% "Use KMS38 activation option instead."
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu instead."
|
||||
) else (
|
||||
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
)
|
||||
|
||||
@ -749,12 +807,15 @@ set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@ -764,6 +825,7 @@ set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
@ -940,7 +1002,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Get Activation IDs from licensing files if not found through WMI
|
||||
@ -1009,7 +1071,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
@ -1063,26 +1125,16 @@ exit /b
|
||||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
@ -1095,9 +1147,16 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||
if defined results call :dk_color %Red% "%results%"
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1189,7 +1248,7 @@ set errorcode=
|
||||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
@ -1203,7 +1262,12 @@ 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% "Reboot your machine using the restart option to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||
set fixes=%fixes% %mas%fix_service
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
@ -1219,14 +1283,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
||||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||
|
||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -1249,18 +1320,21 @@ echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
||||
|
||||
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
@ -1269,19 +1343,17 @@ if "%osSKU%"=="164" set osedition=ProfessionalEducation
|
||||
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
|
||||
)
|
||||
|
||||
if not defined officeact (
|
||||
if not defined notwinact (
|
||||
if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) else (
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||
set error=1
|
||||
set skunotfound=1
|
||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
||||
)
|
||||
|
||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
@ -1303,7 +1375,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
||||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
if %errorlevel% NEQ 0 set wmifailed=1
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
if defined wmifailed (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||
@ -1312,7 +1384,7 @@ set showfix=1
|
||||
)
|
||||
|
||||
|
||||
if not defined officeact (
|
||||
if not defined notwinact (
|
||||
if %winbuild% GEQ 10240 (
|
||||
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
|
||||
set /a "sum/=3"
|
||||
@ -1345,17 +1417,16 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
||||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
@ -1364,7 +1435,7 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu
|
||||
)
|
||||
if defined _sppint (
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System May Deactivate Later]"
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
@ -1376,15 +1447,14 @@ echo Checking SPP In IFEO [%_sppint%]
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
set error=1
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
)
|
||||
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
@ -1399,7 +1469,7 @@ set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
|
||||
@ -1423,20 +1493,22 @@ set showfix=1
|
||||
)
|
||||
|
||||
|
||||
if not defined notwinact (
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined allapps (
|
||||
set error=1
|
||||
set "_notfoundids=Not found"
|
||||
)
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||
@ -1446,11 +1518,15 @@ call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%toke
|
||||
|
||||
|
||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
|
||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
|
||||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System May Deactivate Later]"
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -1458,7 +1534,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
||||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||
|
||||
set permerror=
|
||||
if %winbuild% GEQ 9200 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
@ -1518,7 +1594,7 @@ exit /b
|
||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
||||
$count = 0
|
||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
||||
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||
$count++
|
||||
}
|
||||
}
|
||||
@ -1527,7 +1603,7 @@ $minBuildNumber = 14393
|
||||
if ($osVersion.Build -ge $minBuildNumber) {
|
||||
$subkeyHashTable = @{}
|
||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
||||
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||
$keyNumber = $subkeyName -replace '.*-', ''
|
||||
$subkeyHashTable[$keyNumber] = $true
|
||||
}
|
||||
@ -1541,7 +1617,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
||||
}
|
||||
}
|
||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||
if ($_ -match '.*-.*-.*-.*-.*-') {
|
||||
if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
@ -1592,7 +1668,8 @@ 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_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@set masver=3.0
|
||||
@echo off
|
||||
|
||||
|
||||
@ -47,26 +47,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
@ -110,7 +112,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@ -125,7 +127,7 @@ echo:
|
||||
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 Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@ -146,6 +148,8 @@ set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/KMS38" set _act=1
|
||||
@ -163,15 +167,25 @@ set _k38=
|
||||
call :dk_setvar
|
||||
set "specific_kms=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f"
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 14393 (
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo KMS38 activation is only supported on Windows 10/11/Server, build 14393 and later.
|
||||
echo:
|
||||
if %winbuild% LSS 10240 (
|
||||
call :dk_color %Blue% "Use Online KMS activation option."
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu."
|
||||
) else (
|
||||
call :dk_color %Blue% "Use HWID activation option."
|
||||
call :dk_color %Blue% "Use HWID activation option from the main menu."
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
@ -208,32 +222,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: 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 dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@ -246,6 +234,48 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
echo %tstresult%
|
||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
%eline%
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@ -266,6 +296,7 @@ if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
@ -291,9 +322,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@ -309,7 +350,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
cls
|
||||
@ -372,7 +413,7 @@ if defined _fmiss (
|
||||
echo [%_fmiss%] file is missing, aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -425,10 +466,11 @@ echo Server Evaluation cannot be activated. Convert it to full Server OS.
|
||||
echo:
|
||||
call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
|
||||
) else (
|
||||
echo Evaluation editions cannot be activated outside of their evaluation period.
|
||||
echo Evaluation editions cannot be activated outside of their evaluation period.
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
@ -444,8 +486,19 @@ if not exist "!_work!\clipup.exe" (
|
||||
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.
|
||||
set fixes=%fixes% %mas%kms38
|
||||
echo %mas%kms38
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%kms38"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
:: Check file signature
|
||||
|
||||
if defined a_cor (
|
||||
%psc% "if (-not (Get-AuthenticodeSignature -FilePath '!_work!\clipup.exe').IsOSBinary) {Exit 3}" %nul%
|
||||
if !errorlevel!==3 (
|
||||
%eline%
|
||||
echo Valid digital signature not found in clipup.exe file.
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
@ -505,17 +558,28 @@ call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Acti
|
||||
)
|
||||
|
||||
if not defined key if not defined _gvlk (
|
||||
%eline%
|
||||
echo:
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support KMS38 activation.
|
||||
echo Make sure you are using the latest version of the script.
|
||||
|
||||
if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
||||
|
||||
if defined skunotfound (
|
||||
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
if defined sppks (
|
||||
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
if not defined skunotfound if not defined sppks (
|
||||
call :dk_color %Red% "This product does not support KMS38 activation."
|
||||
call :dk_color %Blue% "Use TSforge activation option from the main menu."
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
) else (
|
||||
echo Required license files were not found in %SysPath%\spp\tokens\skus\
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
echo:
|
||||
goto dk_done
|
||||
@ -558,7 +622,7 @@ if %_wmic% EQU 0 for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELE
|
||||
if not defined app (
|
||||
call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..."
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto :dk_done
|
||||
)
|
||||
|
||||
@ -640,7 +704,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||
|
||||
:: Stop sppsvc
|
||||
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
|
||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
||||
echo Stopping sppsvc Service [Successful]
|
||||
@ -649,14 +713,14 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
||||
)
|
||||
|
||||
%_xmlexist% (
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
|
||||
%_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 %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -726,7 +790,7 @@ goto :k_final
|
||||
call :dk_color %Red% "Activation Failed"
|
||||
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@ -849,12 +913,15 @@ set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@ -864,6 +931,7 @@ set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
@ -1056,7 +1124,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Install License files using Powershell/WMI instead of slmgr.vbs
|
||||
@ -1107,7 +1175,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
@ -1206,26 +1274,16 @@ exit /b
|
||||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
@ -1238,9 +1296,16 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators
|
||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||
if defined results call :dk_color %Red% "%results%"
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1332,7 +1397,7 @@ set errorcode=
|
||||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
@ -1346,7 +1411,12 @@ 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% "Reboot your machine using the restart option to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||
set fixes=%fixes% %mas%fix_service
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
@ -1362,14 +1432,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
||||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||
|
||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -1392,18 +1469,21 @@ echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
|
||||
|
||||
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||
set fixes=%fixes% %mas%evaluation_editions
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
@ -1412,19 +1492,17 @@ if "%osSKU%"=="164" set osedition=ProfessionalEducation
|
||||
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
|
||||
)
|
||||
|
||||
if not defined officeact (
|
||||
if not defined notwinact (
|
||||
if %osedition%==0 (
|
||||
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
|
||||
) else (
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
|
||||
set error=1
|
||||
set skunotfound=1
|
||||
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
|
||||
)
|
||||
|
||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||
)
|
||||
)
|
||||
@ -1446,7 +1524,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
||||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
if %errorlevel% NEQ 0 set wmifailed=1
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
if defined wmifailed (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||
@ -1455,7 +1533,7 @@ set showfix=1
|
||||
)
|
||||
|
||||
|
||||
if not defined officeact (
|
||||
if not defined notwinact (
|
||||
if %winbuild% GEQ 10240 (
|
||||
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
|
||||
set /a "sum/=3"
|
||||
@ -1488,17 +1566,16 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
||||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
@ -1507,7 +1584,7 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu
|
||||
)
|
||||
if defined _sppint (
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System May Deactivate Later]"
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
@ -1519,15 +1596,14 @@ echo Checking SPP In IFEO [%_sppint%]
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
set error=1
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
)
|
||||
|
||||
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||
set error=1
|
||||
set showfix=1
|
||||
)
|
||||
@ -1542,7 +1618,7 @@ set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
|
||||
@ -1566,20 +1642,22 @@ set showfix=1
|
||||
)
|
||||
|
||||
|
||||
if not defined notwinact (
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined allapps (
|
||||
set error=1
|
||||
set "_notfoundids=Not found"
|
||||
)
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
|
||||
@ -1589,11 +1667,15 @@ call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%toke
|
||||
|
||||
|
||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
|
||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
|
||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
|
||||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System May Deactivate Later]"
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -1601,7 +1683,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
||||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||
|
||||
set permerror=
|
||||
if %winbuild% GEQ 9200 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
@ -1661,7 +1743,7 @@ exit /b
|
||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
||||
$count = 0
|
||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
||||
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||
$count++
|
||||
}
|
||||
}
|
||||
@ -1670,7 +1752,7 @@ $minBuildNumber = 14393
|
||||
if ($osVersion.Build -ge $minBuildNumber) {
|
||||
$subkeyHashTable = @{}
|
||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
||||
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||
$keyNumber = $subkeyName -replace '.*-', ''
|
||||
$subkeyHashTable[$keyNumber] = $true
|
||||
}
|
||||
@ -1684,7 +1766,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
||||
}
|
||||
}
|
||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||
if ($_ -match '.*-.*-.*-.*-.*-') {
|
||||
if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
@ -1735,7 +1817,8 @@ 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_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
@ -1818,36 +1901,6 @@ a99cc1f0-7719-4306-9645-294102fbff95_FDNH6-VW9RW-BXPJ7-4XTYG-23%f%9TB_168_Server
|
||||
3dbf341b-5f6c-4fa7-b936-699dce9e263f_VP34G-4NPPG-79JTQ-864T4-R3%f%MQX_168_ServerAzureCor_RS1
|
||||
c2e946d1-cfa2-4523-8c87-30bc696ee584_XGN3F-F394H-FD2MY-PP6FD-8M%f%CRC_407_ServerTurbine_Ge
|
||||
19b5e0fb-4431-46bc-bac1-2f1873e4ae73_NTBV8-9K7Q8-V27C6-M2BTV-KH%f%MXV_407_ServerTurbine_RS5
|
||||
:: Old Preview editions from build 14393 - Generated keys
|
||||
43f2ab05-7c87-4d56-b27c-44d0f9a3dabd_JDTNC-PP77T-T9H2W-G4J2J-VH%f%7MW___4_Enterprise
|
||||
d3872724-5c08-4b1b-91f2-fc9eafed4990_3NMDC-G7C3W-68RGP-CQK9H-B7%f%QK9___7_ServerStandard
|
||||
ba947c44-d19d-4786-b6ae-22770bc94c54_T8N4T-C6P4F-W48KM-CYJT9-KP%f%69Y___8_ServerDatacenter
|
||||
e5676f13-9b66-4a1f-8b0c-43490e236202_RN84D-7HCWY-FTCBK-J3GHK-RM%f%YVT__17_ServerWeb
|
||||
6ae51eeb-c268-4a21-9aae-df74c38b586d_RN3QB-GT6D7-YB3VH-F3RPB-3G%f%P42__27_EnterpriseN
|
||||
ff808201-fec6-4fd4-ae16-abbddade5706_CC6JP-VN67C-8KCJ4-4V48V-HX%f%M9B__48_Professional
|
||||
34260150-69ac-49a3-8a0d-4a403ab55763_TNYKV-X79V3-CPD6X-Y2MRW-D9%f%M9H__49_ProfessionalN
|
||||
9cc2564c-292e-4d8a-b9f9-1f5007d9409a_82CNJ-W82TW-BY23W-BVJ6W-W4%f%2Y2__86_EmbeddedIndustryA
|
||||
c35a9336-fb02-48db-8f4d-245c17f03667_NXTJV-CRQYQ-W77JR-GG84R-HQ%f%VHX__89_EmbeddedIndustry
|
||||
4daf1e3e-6be9-4848-8f5a-a18a0d2895e1_7MNJY-B88MV-WQKVP-BQ6DK-6C%f%M4G__91_EmbeddedIndustryE
|
||||
b554b49f-4d57-4f08-955e-87886f514d49_4QC36-NW3YH-D2Y9D-RJPC7-VV%f%BDF__97_CoreARM
|
||||
4dfd543d-caa6-4f69-a95f-5ddfe2b89567_KG3N2-VRJ6F-P36TD-6MMCF-PP%f%QX7__98_CoreN
|
||||
5fe40dd6-cf1f-4cf2-8729-92121ac2e997_XFNM6-P9FYP-MRF6P-MM6V2-27%f%KDP__99_CoreCountrySpecific
|
||||
2cc171ef-db48-4adc-af09-7c574b37f139_N47PH-2Y8Q8-DGMMV-3PGD8-WB%f%6Q2_100_CoreSingleLanguage
|
||||
903663f7-d2ab-49c9-8942-14aa9e0a9c72_VWCNX-7FKBD-FHJYG-XBR4B-88%f%GQH_101_Core
|
||||
cc17e18a-fa93-43d6-9179-72950a1e931a_FDF9N-KGHKC-R9G6Y-W2TGC-9Q%f%CCB_103_ProfessionalWMC
|
||||
c436def1-0dcc-4849-9a59-8b6142eb70f3_2FNVD-CPYC6-WXD8M-T64BF-84%f%3GJ_111_CoreConnected
|
||||
fd5ae385-f5cf-4b53-b1fa-1af6fff7c0d8_HJN63-7Q4G4-VDW7X-TRMW8-GV%f%H3Q_112_ProfessionalStudent
|
||||
86f72c8d-8363-4188-b574-1a53cb374711_JGRP6-TNJWX-KQWHJ-6D3FJ-RX%f%73B_113_CoreConnectedN
|
||||
687f6358-6a21-453a-a712-3b3b57123827_3K4DY-NVP2W-H8DGV-42K3B-2P%f%PK9_114_ProfessionalStudentN
|
||||
5b120df4-ea3f-4e82-b0c0-6568f719730e_2N382-D6PKK-QTX4D-2JJYK-M9%f%73H_115_CoreConnectedSingleLanguage
|
||||
a8651bfb-7fe0-40df-b156-87337ecd5acc_RPM6J-N62DM-DC6XH-2JXMG-23%f%66R_116_CoreConnectedCountrySpecific
|
||||
5b2add49-b8f4-42e0-a77c-adad4efeeeb1_NT3V6-XMBK7-Q66MF-VMKR4-FC%f%26C_119_PPIPro
|
||||
af43f7f0-3b1e-4266-a123-1fdb53f4323b_BNJR8-P8QHP-VQ4QY-MVPQP-8X%f%C37_121_Education
|
||||
075aca1f-05d7-42e5-a3ce-e349e7be7078_RFNBP-FDD7Q-6FHYQ-9M9Y7-MB%f%JH3_122_EducationN
|
||||
2cf5af84-abab-4ff0-83f8-f040fb2576eb_NVYRQ-D2F32-6HGXW-DKGWM-R6%f%Y8H_125_EnterpriseS
|
||||
11a37f09-fb7f-4002-bd84-f3ae71d11e90_NMBY8-V3CV7-BX6K6-2922Y-43%f%MCH_126_EnterpriseSN
|
||||
aa234c15-ee34-4e5f-adb5-73afafb77143_DNJYG-CM8W6-4W3TX-VCK66-FV%f%WCC_127_ProfessionalS
|
||||
9f6a1bc9-5278-4991-88c9-7301c87a75ea_XB9DG-NPJ72-XRH69-7DF3Q-G8%f%3R4_128_ProfessionalSN
|
||||
) do (
|
||||
for /f "tokens=1-5 delims=_" %%A in ("%%#") do if %osSKU%==%%C (
|
||||
if %1==key if not defined key echo "!allapps!" | find /i "%%A" %nul1% && set key=%%B
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
Activation Type Supported Product Activation Period
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
HWID - Windows 10-11 - Permanent
|
||||
Ohook - Office - Permanent
|
||||
KMS38 - Windows 10-11-Server - Till the Year 2038
|
||||
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
|
||||
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
For more details, use the respective docs section here https://massgrave.dev/
|
7432
MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
Normal file
7432
MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
Normal file
File diff suppressed because it is too large
Load Diff
14
MAS/Separate-Files-Version/Activators/_ReadMe.txt
Normal file
14
MAS/Separate-Files-Version/Activators/_ReadMe.txt
Normal file
@ -0,0 +1,14 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
Activation Type Supported Product Activation Period
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
HWID - Windows 10-11 - Permanent
|
||||
Ohook - Office - Permanent
|
||||
TSforge - Windows / ESU / Office - Permanent
|
||||
KMS38 - Windows 10-11-Server - Till the Year 2038
|
||||
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
|
||||
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
Check the below link for more details:
|
||||
https://massgrave.dev/chart
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@set masver=3.0
|
||||
@echo off
|
||||
|
||||
|
||||
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
@ -67,7 +69,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@ -82,7 +84,7 @@ echo:
|
||||
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 Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@ -103,6 +105,8 @@ set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
@ -119,6 +123,16 @@ set "line=echo _________________________________________________________________
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -158,32 +172,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: 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 dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@ -196,6 +184,48 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
echo %tstresult%
|
||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
%eline%
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@ -216,6 +246,7 @@ if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
@ -241,9 +272,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@ -259,7 +300,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@ -278,7 +319,7 @@ if not exist %SysPath%\sppsvc.exe (
|
||||
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -316,7 +357,7 @@ if %osedition%==0 (
|
||||
echo Failed to detect OS Edition. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -389,7 +430,7 @@ echo which is not officially supported on your Windows build version %winbuild%.
|
||||
echo Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -403,7 +444,7 @@ echo Unsupported Office %verchk% is installed on your Windows build version %win
|
||||
echo Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -421,20 +462,23 @@ echo:
|
||||
echo:
|
||||
echo ____________________________________________________________
|
||||
echo:
|
||||
echo [1] Change - Office Edition
|
||||
echo [2] Add - Office Edition
|
||||
echo [3] Remove - Office Edition
|
||||
echo [1] Change all editions
|
||||
echo [2] Add edition
|
||||
echo [3] Remove edition
|
||||
echo:
|
||||
echo [4] Add/Remove apps
|
||||
echo ____________________________________________
|
||||
echo:
|
||||
echo [4] Change Office Update Channel
|
||||
echo [5] Change Office Update Channel
|
||||
echo [0] %_exitmsg%
|
||||
echo ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,0]"
|
||||
choice /C:12340 /N
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,5,0]"
|
||||
choice /C:123450 /N
|
||||
set _el=!errorlevel!
|
||||
if !_el!==5 exit /b
|
||||
if !_el!==4 goto :oe_changeupdchnl
|
||||
if !_el!==6 exit /b
|
||||
if !_el!==5 goto :oe_changeupdchnl
|
||||
if !_el!==4 goto :oe_editedition
|
||||
if !_el!==3 goto :oe_removeedition
|
||||
if !_el!==2 set change=0& goto :oe_edition
|
||||
if !_el!==1 set change=1& goto :oe_edition
|
||||
@ -452,7 +496,12 @@ goto :oe_goback
|
||||
|
||||
cls
|
||||
if not defined terminal mode 76, 25
|
||||
title Change Office Edition %masver%
|
||||
if %change%==1 (
|
||||
title Change all editions %masver%
|
||||
) else (
|
||||
title Add edition %masver%
|
||||
)
|
||||
|
||||
echo:
|
||||
echo:
|
||||
echo:
|
||||
@ -501,20 +550,30 @@ if not exist %SystemRoot%\Temp\%list%.txt (
|
||||
echo Failed to generate available editions list.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto :oe_goback
|
||||
)
|
||||
|
||||
set inpt=
|
||||
set counter=0
|
||||
set verified=0
|
||||
set _notfound=
|
||||
set targetedition=
|
||||
|
||||
%line%
|
||||
echo:
|
||||
call :dk_color %Gray% "Installed Office editions: %_oIds%"
|
||||
call :dk_color %Gray% "You can select one of the following Office Editions."
|
||||
if %winbuild% LSS 10240 echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
||||
if %winbuild% LSS 10240 (
|
||||
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
||||
) else (
|
||||
for %%# in (2019 2021 2024) do (
|
||||
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || (
|
||||
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
|
||||
)
|
||||
)
|
||||
if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this list because old version [%_version%] of Office is installed."
|
||||
)
|
||||
%line%
|
||||
echo:
|
||||
|
||||
@ -544,6 +603,8 @@ if %verified%==0 goto :oe_editionchange
|
||||
|
||||
:: Set app exclusions
|
||||
|
||||
:oe_excludeappspre
|
||||
|
||||
cls
|
||||
set suites=
|
||||
echo %list% | find /i "Suites" %nul1% && (
|
||||
@ -554,7 +615,7 @@ if not exist %SystemRoot%\Temp\getAppIds.txt (
|
||||
echo Failed to generate available apps list.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto :oe_goback
|
||||
)
|
||||
)
|
||||
@ -615,7 +676,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard:"
|
||||
choice /C:AENOPJRVWLDT10 /N
|
||||
set _el=!errorlevel!
|
||||
if !_el!==14 goto :oe_editionchangepre
|
||||
if !_el!==14 goto :oemenu
|
||||
if !_el!==13 call :excludelist & goto :oe_editionchangefinal
|
||||
if !_el!==12 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off))
|
||||
if !_el!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
|
||||
@ -635,18 +696,18 @@ goto :oe_excludeapps
|
||||
|
||||
set excludelist=
|
||||
for %%# in (
|
||||
Access
|
||||
Excel
|
||||
OneNote
|
||||
Outlook
|
||||
PowerPoint
|
||||
Project
|
||||
Publisher
|
||||
Visio
|
||||
Word
|
||||
Lync
|
||||
OneDrive
|
||||
Teams
|
||||
access
|
||||
excel
|
||||
onenote
|
||||
outlook
|
||||
powerpoint
|
||||
project
|
||||
publisher
|
||||
visio
|
||||
word
|
||||
lync
|
||||
onedrive
|
||||
teams
|
||||
) do (
|
||||
if /i "!%%#_st!"=="Off" if defined excludelist (set excludelist=!excludelist!,%%#) else (set excludelist=,%%#)
|
||||
)
|
||||
@ -717,7 +778,7 @@ goto :oe_goback
|
||||
:: OfficeClickToRun.exe with productstoadd method is used here to add editions
|
||||
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
|
||||
|
||||
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=Groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
|
||||
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
|
||||
|
||||
if %change%==1 (
|
||||
set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
|
||||
@ -736,7 +797,7 @@ if %errorcode% EQU 0 (
|
||||
call :dk_color %Gray% "Now run the Office activation option from the main menu."
|
||||
) else (
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
call :oe_tempcleanup
|
||||
@ -744,10 +805,71 @@ goto :oe_goback
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Edit Office edition
|
||||
|
||||
:oe_editedition
|
||||
|
||||
cls
|
||||
title Add/Remove Apps %masver%
|
||||
|
||||
call :oe_chkinternet
|
||||
if not defined _int (
|
||||
goto :oe_goback
|
||||
)
|
||||
|
||||
set change=0
|
||||
call :ch_getinfo
|
||||
cls
|
||||
|
||||
if not defined terminal (
|
||||
mode 98, 35
|
||||
)
|
||||
|
||||
set inpt=
|
||||
set counter=0
|
||||
set verified=0
|
||||
set targetedition=
|
||||
|
||||
%line%
|
||||
echo:
|
||||
call :dk_color %Gray% "You can edit [add/remove apps] one of the following Office editions."
|
||||
%line%
|
||||
echo:
|
||||
|
||||
for %%A in (%_oIds%) do (
|
||||
set /a counter+=1
|
||||
echo [!counter!] %%A
|
||||
set targetedition!counter!=%%A
|
||||
)
|
||||
|
||||
%line%
|
||||
echo:
|
||||
echo [0] Go Back
|
||||
echo:
|
||||
call :dk_color %_Green% "Enter an option number using your keyboard and press Enter to confirm:"
|
||||
set /p inpt=
|
||||
if "%inpt%"=="" goto :oe_editedition
|
||||
if "%inpt%"=="0" goto :oemenu
|
||||
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
|
||||
set targetedition=!targetedition%inpt%!
|
||||
if %verified%==0 goto :oe_editedition
|
||||
|
||||
::===============
|
||||
|
||||
cls
|
||||
if not defined terminal mode 98, 32
|
||||
|
||||
echo %targetedition% | findstr /i "Access Excel OneNote Outlook PowerPoint Project Publisher Skype Visio Word" %nul% && (set list=SingleApps) || (set list=Suites)
|
||||
goto :oe_excludeappspre
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Remove Office editions
|
||||
|
||||
:oe_removeedition
|
||||
|
||||
title Remove Office editions %masver%
|
||||
|
||||
call :ch_getinfo
|
||||
|
||||
cls
|
||||
@ -818,7 +940,7 @@ echo %c2rcommand%
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
goto :oe_goback
|
||||
@ -829,6 +951,7 @@ goto :oe_goback
|
||||
|
||||
:oe_changeupdchnl
|
||||
|
||||
title Change Office update channel %masver%
|
||||
call :ch_getinfo
|
||||
|
||||
cls
|
||||
@ -884,10 +1007,12 @@ for %%# in (
|
||||
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
|
||||
set supported=
|
||||
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
|
||||
if %winbuild% GEQ 10240 (if defined ltsc19 echo %%B | findstr /i "LTSC\>" %nul% || set supported=)
|
||||
if %winbuild% GEQ 10240 (if defined ltsc21 echo %%B | findstr /i "LTSC2021\>" %nul% || set supported=)
|
||||
if %winbuild% GEQ 10240 (if defined ltsc24 echo %%B | findstr /i "LTSC2024\>" %nul% || set supported=)
|
||||
if %winbuild% GEQ 10240 (if not defined ltscfound echo %%B | findstr /i "LTSC" %nul% && set supported=)
|
||||
if %winbuild% GEQ 10240 (
|
||||
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported=
|
||||
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported=
|
||||
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported=
|
||||
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported=
|
||||
)
|
||||
if defined supported (
|
||||
set /a counter+=1
|
||||
if !counter! LSS 10 (
|
||||
@ -963,7 +1088,7 @@ echo:
|
||||
echo %updcommand%
|
||||
%updcommand%
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%troubleshoot
|
||||
goto :oe_goback
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -974,7 +1099,8 @@ call :oe_tempcleanup
|
||||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
@ -1057,13 +1183,15 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
|
||||
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
|
||||
)
|
||||
|
||||
echo %_AudienceData% | findstr /i "LTSC\>" %nul% && set ltsc19=LTSC
|
||||
set "audidata4=%_AudienceData:~-4%"
|
||||
|
||||
if /i "%audidata4%"=="LTSC" set ltsc19=LTSC
|
||||
echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
|
||||
|
||||
echo %_AudienceData% | findstr /i "LTSC2021\>" %nul% && set ltsc21=LTSC2021
|
||||
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021
|
||||
echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
|
||||
|
||||
echo %_AudienceData% | findstr /i "LTSC2024\>" %nul% && set ltsc24=LTSC2024
|
||||
if /i "%audidata4%"=="2024" set ltsc24=LTSC2024
|
||||
:: LTSC 2024 build is not fixed yet
|
||||
|
||||
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
|
||||
@ -1223,12 +1351,15 @@ set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@ -1238,6 +1369,7 @@ set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
@ -1280,7 +1412,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
@ -1320,7 +1452,8 @@ 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_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@set masver=3.0
|
||||
@echo off
|
||||
|
||||
|
||||
@ -36,26 +36,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
@ -72,7 +74,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@ -87,7 +89,7 @@ echo:
|
||||
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 Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@ -108,6 +110,8 @@ set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
@ -124,6 +128,16 @@ set "line=echo _________________________________________________________________
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -163,32 +177,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: 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 dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@ -201,6 +189,48 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
echo %tstresult%
|
||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
%eline%
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@ -221,6 +251,7 @@ if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
@ -246,9 +277,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@ -264,7 +305,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@ -305,7 +346,7 @@ if not exist %SysPath%\%%# (
|
||||
echo [%SysPath%\%%#] file is missing, aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
@ -330,15 +371,15 @@ if defined UBR (set "fullbuild=%%G.!UBR!") else (set "fullbuild=%%G.%%H")
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check Activation ID
|
||||
:: Check Activation IDs
|
||||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined allapps (
|
||||
%eline%
|
||||
echo Either key is not insalled or script failed to get installed key's activation ID. Aborting...
|
||||
echo Failed to find activation IDs. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -346,31 +387,30 @@ goto dk_done
|
||||
|
||||
:: Check Windows Edition and branch
|
||||
|
||||
set osedition=0
|
||||
set dismedition=
|
||||
set osedition=
|
||||
set dismnotworking=
|
||||
|
||||
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "osedition=%%a"
|
||||
if not defined osedition set dismnotworking=1
|
||||
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
if not defined osedition %chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 (
|
||||
if not defined osedition (
|
||||
%eline%
|
||||
echo Failed to detect OS edition, aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "regedition=%%a"
|
||||
if /i not "%osedition%"=="%regedition%" (
|
||||
set "showeditionerror=call :dk_color %_Yellow% "Mismatch found [WMI-%osedition%] [Reg-%regedition%].""
|
||||
set "showeditionerror=call :dk_color %_Yellow% "[%osedition%] [Reg-%regedition%].""
|
||||
)
|
||||
|
||||
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "dismedition=%%a"
|
||||
if not defined dismedition set dismnotworking=1
|
||||
|
||||
set branch=
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildBranch %nul6%') do set "branch=%%b"
|
||||
|
||||
@ -388,7 +428,7 @@ if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-Ta
|
||||
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
||||
|
||||
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
call :ced_edilist
|
||||
if %winbuild% GEQ 17063 call :ced_edilist
|
||||
if /i "%osedition:~0,4%"=="Core" set _pro=Professional
|
||||
if /i "%osedition%"=="CoreN" set _pro=ProfessionalN
|
||||
set "_dtarget= %_dtarget% !_wtarget! !_pro! "
|
||||
@ -501,7 +541,7 @@ set _dismapi=0
|
||||
|
||||
:: Check if DISM API or slmgr.vbs is required for edition upgrade
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" (
|
||||
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\%targetedition%*.xrm-ms" (
|
||||
echo %_wtarget% | find /i " %targetedition% " || (
|
||||
set _dismapi=1
|
||||
)
|
||||
@ -524,7 +564,7 @@ echo [%targetedition% ^| %winbuild%]
|
||||
echo Failed to get product key from pkeyhelper.dll.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -579,7 +619,7 @@ call :dk_color %Gray% "Reboot is required to fully change the edition."
|
||||
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
)
|
||||
|
||||
@ -605,7 +645,7 @@ goto dk_done
|
||||
cls
|
||||
if not defined terminal (
|
||||
mode con cols=105 lines=32
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||
)
|
||||
|
||||
call :ced_rebootflag
|
||||
@ -642,7 +682,7 @@ goto dk_done
|
||||
cls
|
||||
if not defined terminal (
|
||||
mode con cols=105 lines=32
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||
)
|
||||
|
||||
set key=
|
||||
@ -660,7 +700,7 @@ echo [%targetedition% ^| %winbuild%]
|
||||
echo Failed to get product key from pkeyhelper.dll.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@ -700,7 +740,7 @@ 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 Reboot your machine using the restart option and try again.
|
||||
set preperror=1
|
||||
exit /b
|
||||
)
|
||||
@ -736,7 +776,7 @@ echo:
|
||||
call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%change_edition_issues
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%change_edition_issues"
|
||||
exit /b
|
||||
|
||||
:compresslog
|
||||
@ -783,12 +823,15 @@ set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@ -798,6 +841,7 @@ set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
@ -825,14 +869,14 @@ if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call RefreshLicenseStatus
|
||||
if %_wmic% EQU 0 %psc% "$null=(([WMICLASS]'%sps%').GetInstances()).RefreshLicenseStatus()" %nul%
|
||||
exit /b
|
||||
|
||||
:: Get installed products Activation IDs
|
||||
:: Get all products Activation IDs
|
||||
|
||||
:dk_actid
|
||||
:dk_actids
|
||||
|
||||
set apps=
|
||||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1' and PartialProductKey is not null) get ID /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1'' AND PartialProductKey IS NOT NULL').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
|
||||
%chkapp% do (if defined apps (call set "apps=!apps! %%a") else (call set "apps=%%a"))
|
||||
set allapps=
|
||||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
|
||||
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
|
||||
exit /b
|
||||
|
||||
:: Get Edition list
|
||||
@ -867,7 +911,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
||||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
@ -987,7 +1031,8 @@ 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_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
@ -1004,7 +1049,7 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: https://github.com/Gamers-Against-Weed/Set-WindowsCbsEdition
|
||||
:: https://github.com/asdcorp/Set-WindowsCbsEdition
|
||||
|
||||
:cbsxml:[
|
||||
param (
|
||||
@ -1267,11 +1312,15 @@ if (!$Dism::_DismSetEdition($Session, "$TargetEdition", "$Key", 0, 0, 0)) {
|
||||
:: Separator = _
|
||||
|
||||
:: For Windows 10/11 editions, HWID key is listed where ever possible, in Server versions, KMS key is listed where ever possible.
|
||||
:: Only RS3 and older version Generic keys are stored here, later ones are extracted from the pkeyhelper.dll itself
|
||||
:: For Windows, generic keys are mentioned till 22000 and for Server, generic keys are mentioned till 17763, later ones are extracted from the pkeyhelper.dll
|
||||
|
||||
:changeeditiondata
|
||||
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
if %winbuild% GTR 17763 exit /b
|
||||
) else (
|
||||
if %winbuild% GEQ 22000 exit /b
|
||||
)
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=)
|
||||
|
||||
set h=
|
||||
@ -1289,8 +1338,12 @@ YTMG3-N6DKC-DKB77-7M9GH-8HV%h%X7______Retail_Core
|
||||
XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro
|
||||
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education
|
||||
84NGF-MHBT6-FXBX8-QWJK7-DRR%h%8H______Retail_EducationN
|
||||
KCNVH-YKWX8-GJJB9-H9FDT-6F7%h%W2__Volume:MAK_EnterpriseS_VB
|
||||
43TBQ-NH92J-XKTM7-KT3KK-P39%h%PB__OEM:NONSLP_EnterpriseS_RS5
|
||||
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1
|
||||
FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH
|
||||
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%h%PT__Volume:MAK_EnterpriseSN_VB
|
||||
M33WV-NHY3C-R7FPM-BQGPT-239%h%PG__Volume:MAK_EnterpriseSN_RS5
|
||||
2DBW3-N2PJG-MVHW3-G7TDK-9HK%h%R4__Volume:MAK_EnterpriseSN_RS1
|
||||
NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH
|
||||
G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage
|
||||
@ -1302,6 +1355,10 @@ GJTYN-HDMQY-FRR76-HVGC7-QPF%h%8P______Retail_ProfessionalEducationN
|
||||
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG
|
||||
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN
|
||||
NJCF7-PW8QT-3324D-688JX-2YV%h%66______Retail_ServerRdsh
|
||||
XQQYW-NFFMW-XJPBH-K8732-CKF%h%FD______OEM:DM_IoTEnterprise
|
||||
QPM6N-7J2WJ-P88HH-P3YRH-YY7%h%4H__OEM:NONSLP_IoTEnterpriseS
|
||||
K9VKN-3BGWV-Y624W-MCRMQ-BHD%h%CD______Retail_CloudEditionN
|
||||
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%h%4W______Retail_CloudEdition
|
||||
V3WVW-N2PV2-CGWC3-34QGF-VMJ%h%2C______Retail_Cloud
|
||||
NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN
|
||||
2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE
|
||||
|
@ -47,20 +47,40 @@ choice /c 0 /n
|
||||
exit /b
|
||||
|
||||
:sppmgr:
|
||||
param (
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$All,
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$Dlv,
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$IID,
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$Pass
|
||||
)
|
||||
|
||||
function CONOUT($strObj)
|
||||
{
|
||||
Out-Host -Input $strObj
|
||||
}
|
||||
|
||||
function ExitScript($ExitCode = 0)
|
||||
{
|
||||
Exit $ExitCode
|
||||
}
|
||||
|
||||
if (-Not $PSVersionTable) {
|
||||
Write-Host "==== ERROR ====`r`n"
|
||||
Write-Host 'Windows PowerShell 1.0 is not supported by this script.'
|
||||
"==== ERROR ====`r`n"
|
||||
"Windows PowerShell 1.0 is not supported by this script."
|
||||
ExitScript 1
|
||||
}
|
||||
|
||||
if ($ExecutionContext.SessionState.LanguageMode.value__ -NE 0) {
|
||||
Write-Host "==== ERROR ====`r`n"
|
||||
Write-Host 'Windows PowerShell is not running in Full Language Mode.'
|
||||
"==== ERROR ====`r`n"
|
||||
"Windows PowerShell is not running in Full Language Mode."
|
||||
ExitScript 1
|
||||
}
|
||||
|
||||
@ -68,21 +88,34 @@ $winbuild = 1
|
||||
try {
|
||||
$winbuild = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:SystemRoot\System32\kernel32.dll").FileBuildPart
|
||||
} catch {
|
||||
$winbuild = [int](Get-WmiObject Win32_OperatingSystem).BuildNumber
|
||||
$winbuild = [int]([wmi]'Win32_OperatingSystem=@').BuildNumber
|
||||
}
|
||||
|
||||
if ($winbuild -EQ 1) {
|
||||
Write-Host "==== ERROR ====`r`n"
|
||||
Write-Host 'Could not detect Windows build.'
|
||||
"==== ERROR ====`r`n"
|
||||
"Could not detect Windows build."
|
||||
ExitScript 1
|
||||
}
|
||||
|
||||
if ($winbuild -LT 2600) {
|
||||
Write-Host "==== ERROR ====`r`n"
|
||||
Write-Host 'This build of Windows is not supported by this script.'
|
||||
"==== ERROR ====`r`n"
|
||||
"This build of Windows is not supported by this script."
|
||||
ExitScript 1
|
||||
}
|
||||
|
||||
if ($All.IsPresent)
|
||||
{
|
||||
$isAll = {CONOUT "`r"}
|
||||
$noAll = {$null}
|
||||
}
|
||||
else
|
||||
{
|
||||
$isAll = {$null}
|
||||
$noAll = {CONOUT "`r"}
|
||||
}
|
||||
$Dlv = $Dlv.IsPresent
|
||||
$IID = $IID.IsPresent -Or $Dlv.IsPresent
|
||||
|
||||
$NT6 = $winbuild -GE 6000
|
||||
$NT7 = $winbuild -GE 7600
|
||||
$NT9 = $winbuild -GE 9600
|
||||
@ -94,10 +127,10 @@ $line3 = "____________________________________________________________"
|
||||
|
||||
function echoWindows
|
||||
{
|
||||
Write-Host "$line2"
|
||||
Write-Host "=== Windows Status ==="
|
||||
Write-Host "$line2"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line2"
|
||||
CONOUT "=== Windows Status ==="
|
||||
CONOUT "$line2"
|
||||
& $noAll
|
||||
}
|
||||
|
||||
function echoOffice
|
||||
@ -106,18 +139,22 @@ function echoOffice
|
||||
return
|
||||
}
|
||||
|
||||
if ($All.IsPresent) {Write-Host}
|
||||
Write-Host "$line2"
|
||||
Write-Host "=== Office Status ==="
|
||||
Write-Host "$line2"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
& $isAll
|
||||
CONOUT "$line2"
|
||||
CONOUT "=== Office Status ==="
|
||||
CONOUT "$line2"
|
||||
& $noAll
|
||||
|
||||
$script:doMSG = 0
|
||||
}
|
||||
|
||||
function strGetRegistry($strKey, $strName)
|
||||
{
|
||||
Get-ItemProperty -EA 0 $strKey | select -EA 0 -Expand $strName
|
||||
try {
|
||||
return [Microsoft.Win32.Registry]::GetValue($strKey, $strName, $null)
|
||||
} catch {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
function CheckOhook
|
||||
@ -148,55 +185,57 @@ function CheckOhook
|
||||
return
|
||||
}
|
||||
|
||||
if ($All.IsPresent) {Write-Host}
|
||||
Write-Host "$line2"
|
||||
Write-Host "=== Office Ohook Status ==="
|
||||
Write-Host "$line2"
|
||||
Write-Host
|
||||
Write-Host -back 'Black' -fore 'Yellow' 'Ohook for permanent Office activation is installed.'
|
||||
Write-Host -back 'Black' -fore 'Yellow' 'You can ignore the below mentioned Office activation status.'
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
& $isAll
|
||||
CONOUT "$line2"
|
||||
CONOUT "=== Office Ohook Status ==="
|
||||
CONOUT "$line2"
|
||||
$host.UI.WriteLine('Yellow', 'Black', "`r`nOhook for permanent Office activation is installed.`r`nYou can ignore the below mentioned Office activation status.")
|
||||
& $noAll
|
||||
}
|
||||
|
||||
#region WMI
|
||||
function DetectID($strSLP, $strAppId, [ref]$strAppVar)
|
||||
function DetectID($strSLP, $strAppId)
|
||||
{
|
||||
$fltr = "ApplicationID='$strAppId'"
|
||||
if (!$All.IsPresent) {
|
||||
$fltr = $fltr + " AND PartialProductKey <> NULL"
|
||||
}
|
||||
Get-WmiObject $strSLP ID -Filter $fltr -EA 0 | select ID -EA 0 | foreach {
|
||||
$strAppVar.Value = 1
|
||||
}
|
||||
$ppk = (" AND PartialProductKey <> NULL)", ")")[$All.IsPresent]
|
||||
$fltr = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId'"
|
||||
$clause = $fltr + $ppk
|
||||
$sWmi = [wmisearcher]$clause
|
||||
$sWmi.Options.Rewindable = $false
|
||||
return ($sWmi.Get().Count -GT 0)
|
||||
}
|
||||
|
||||
function GetID($strSLP, $strAppId, $strProperty = "ID")
|
||||
function GetID($strSLP, $strAppId)
|
||||
{
|
||||
$NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001)
|
||||
$IDs = [Collections.ArrayList]@()
|
||||
$isAdd = (" AND LicenseDependsOn <> NULL)", ")")[$NT5]
|
||||
$noAdd = " AND LicenseDependsOn IS NULL)"
|
||||
$query = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId' AND PartialProductKey"
|
||||
|
||||
if ($All.IsPresent) {
|
||||
$fltr = "ApplicationID='$strAppId' AND PartialProductKey IS NULL"
|
||||
$clause = $fltr
|
||||
$fltr = $query + " IS NULL"
|
||||
$clause = $fltr + $isAdd
|
||||
$sWmi = [wmisearcher]$clause
|
||||
$sWmi.Options.Rewindable = $false
|
||||
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
|
||||
if (-Not $NT5) {
|
||||
$clause = $fltr + " AND LicenseDependsOn <> NULL"
|
||||
}
|
||||
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
|
||||
if (-Not $NT5) {
|
||||
$clause = $fltr + " AND LicenseDependsOn IS NULL"
|
||||
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
|
||||
$clause = $fltr + $noAdd
|
||||
$sWmi = [wmisearcher]$clause
|
||||
$sWmi.Options.Rewindable = $false
|
||||
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
$fltr = "ApplicationID='$strAppId' AND PartialProductKey <> NULL"
|
||||
$clause = $fltr
|
||||
$fltr = $query + " <> NULL"
|
||||
$clause = $fltr + $isAdd
|
||||
$sWmi = [wmisearcher]$clause
|
||||
$sWmi.Options.Rewindable = $false
|
||||
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
|
||||
if (-Not $NT5) {
|
||||
$clause = $fltr + " AND LicenseDependsOn <> NULL"
|
||||
}
|
||||
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
|
||||
if (-Not $NT5) {
|
||||
$clause = $fltr + " AND LicenseDependsOn IS NULL"
|
||||
Get-WmiObject $strSLP $strProperty -Filter $clause -EA 0 | select -Expand $strProperty -EA 0 | foreach {$IDs += $_}
|
||||
$clause = $fltr + $noAdd
|
||||
$sWmi = [wmisearcher]$clause
|
||||
$sWmi.Options.Rewindable = $false
|
||||
try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {}
|
||||
}
|
||||
|
||||
return $IDs
|
||||
@ -233,38 +272,45 @@ function DetectSubscription {
|
||||
if ($objSvc.SubscriptionEdition.Contains("UNKNOWN") -EQ $false) {$SubMsgEdition = $objSvc.SubscriptionEdition}
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host "Subscription information:"
|
||||
Write-Host " Edition: $SubMsgEdition"
|
||||
Write-Host " Type : $SubMsgType"
|
||||
Write-Host " Status : $SubMsgStatus"
|
||||
Write-Host " Expiry : $SubMsgExpiry"
|
||||
CONOUT "`nSubscription information:"
|
||||
CONOUT " Edition: $SubMsgEdition"
|
||||
CONOUT " Type : $SubMsgType"
|
||||
CONOUT " Status : $SubMsgStatus"
|
||||
CONOUT " Expiry : $SubMsgExpiry"
|
||||
}
|
||||
|
||||
function DetectAdbaClient
|
||||
{
|
||||
CONOUT "`nAD Activation client information:"
|
||||
CONOUT " Object Name: $ADActivationObjectName"
|
||||
CONOUT " Domain Name: $ADActivationObjectDN"
|
||||
CONOUT " CSVLK Extended PID: $ADActivationCsvlkPid"
|
||||
CONOUT " CSVLK Activation ID: $ADActivationCsvlkSkuId"
|
||||
}
|
||||
|
||||
function DetectAvmClient
|
||||
{
|
||||
Write-Host
|
||||
Write-Host "Automatic VM Activation client information:"
|
||||
CONOUT "`nAutomatic VM Activation client information:"
|
||||
if (-Not [String]::IsNullOrEmpty($IAID)) {
|
||||
Write-Host " Guest IAID: $IAID"
|
||||
CONOUT " Guest IAID: $IAID"
|
||||
} else {
|
||||
Write-Host " Guest IAID: Not Available"
|
||||
CONOUT " Guest IAID: Not Available"
|
||||
}
|
||||
if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostMachineName)) {
|
||||
Write-Host " Host machine name: $AutomaticVMActivationHostMachineName"
|
||||
CONOUT " Host machine name: $AutomaticVMActivationHostMachineName"
|
||||
} else {
|
||||
Write-Host " Host machine name: Not Available"
|
||||
CONOUT " Host machine name: Not Available"
|
||||
}
|
||||
if ($AutomaticVMActivationLastActivationTime.Substring(0,4) -NE "1601") {
|
||||
$EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($AutomaticVMActivationLastActivationTime),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt')
|
||||
Write-Host " Activation time: $EED UTC"
|
||||
CONOUT " Activation time: $EED UTC"
|
||||
} else {
|
||||
Write-Host " Activation time: Not Available"
|
||||
CONOUT " Activation time: Not Available"
|
||||
}
|
||||
if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostDigitalPid2)) {
|
||||
Write-Host " Host Digital PID2: $AutomaticVMActivationHostDigitalPid2"
|
||||
CONOUT " Host Digital PID2: $AutomaticVMActivationHostDigitalPid2"
|
||||
} else {
|
||||
Write-Host " Host Digital PID2: Not Available"
|
||||
CONOUT " Host Digital PID2: Not Available"
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,32 +340,30 @@ function DetectKmsHost
|
||||
$KeyManagementServiceLowPriority = "Normal"
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host "Key Management Service host information:"
|
||||
Write-Host " Current count: $KeyManagementServiceCurrentCount"
|
||||
Write-Host " Listening on Port: $KeyManagementServiceListeningPort"
|
||||
Write-Host " DNS publishing: $KeyManagementServiceDnsPublishing"
|
||||
Write-Host " KMS priority: $KeyManagementServiceLowPriority"
|
||||
CONOUT "`nKey Management Service host information:"
|
||||
CONOUT " Current count: $KeyManagementServiceCurrentCount"
|
||||
CONOUT " Listening on Port: $KeyManagementServiceListeningPort"
|
||||
CONOUT " DNS publishing: $KeyManagementServiceDnsPublishing"
|
||||
CONOUT " KMS priority: $KeyManagementServiceLowPriority"
|
||||
if (-Not [String]::IsNullOrEmpty($KeyManagementServiceTotalRequests)) {
|
||||
Write-Host
|
||||
Write-Host "Key Management Service cumulative requests received from clients:"
|
||||
Write-Host " Total: $KeyManagementServiceTotalRequests"
|
||||
Write-Host " Failed: $KeyManagementServiceFailedRequests"
|
||||
Write-Host " Unlicensed: $KeyManagementServiceUnlicensedRequests"
|
||||
Write-Host " Licensed: $KeyManagementServiceLicensedRequests"
|
||||
Write-Host " Initial grace period: $KeyManagementServiceOOBGraceRequests"
|
||||
Write-Host " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests"
|
||||
Write-Host " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests"
|
||||
Write-Host " Notification: $KeyManagementServiceNotificationRequests"
|
||||
CONOUT "`nKey Management Service cumulative requests received from clients:"
|
||||
CONOUT " Total: $KeyManagementServiceTotalRequests"
|
||||
CONOUT " Failed: $KeyManagementServiceFailedRequests"
|
||||
CONOUT " Unlicensed: $KeyManagementServiceUnlicensedRequests"
|
||||
CONOUT " Licensed: $KeyManagementServiceLicensedRequests"
|
||||
CONOUT " Initial grace period: $KeyManagementServiceOOBGraceRequests"
|
||||
CONOUT " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests"
|
||||
CONOUT " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests"
|
||||
if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"}
|
||||
}
|
||||
}
|
||||
|
||||
function DetectKmsClient
|
||||
{
|
||||
if ($null -NE $VLActivationTypeEnabled) {Write-Host "Configured Activation Type: $($VLActTypes[$VLActivationTypeEnabled])"}
|
||||
Write-Host
|
||||
if ($null -NE $VLActivationTypeEnabled) {CONOUT "Configured Activation Type: $($VLActTypes[$VLActivationTypeEnabled])"}
|
||||
CONOUT "`r"
|
||||
if ($LicenseStatus -NE 1) {
|
||||
Write-Host "Please activate the product in order to update KMS client information values."
|
||||
CONOUT "Please activate the product in order to update KMS client information values."
|
||||
return
|
||||
}
|
||||
|
||||
@ -352,33 +396,42 @@ function DetectKmsClient
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Key Management Service client information:"
|
||||
Write-Host " Client Machine ID (CMID): $($objSvc.ClientMachineID)"
|
||||
CONOUT "Key Management Service client information:"
|
||||
CONOUT " Client Machine ID (CMID): $($objSvc.ClientMachineID)"
|
||||
if ($null -EQ $KmsReg) {
|
||||
Write-Host " $KmsDns"
|
||||
Write-Host " Registered KMS machine name: KMS name not available"
|
||||
CONOUT " $KmsDns"
|
||||
CONOUT " Registered KMS machine name: KMS name not available"
|
||||
} else {
|
||||
Write-Host " $KmsReg"
|
||||
CONOUT " $KmsReg"
|
||||
}
|
||||
if ($null -NE $DiscoveredKeyManagementServiceMachineIpAddress) {Write-Host " KMS machine IP address: $DiscoveredKeyManagementServiceMachineIpAddress"}
|
||||
Write-Host " KMS machine extended PID: $KeyManagementServiceProductKeyID"
|
||||
Write-Host " Activation interval: $VLActivationInterval minutes"
|
||||
Write-Host " Renewal interval: $VLRenewalInterval minutes"
|
||||
if ($null -NE $KeyManagementServiceHostCaching) {Write-Host " KMS host caching: $KeyManagementServiceHostCaching"}
|
||||
if (-Not [String]::IsNullOrEmpty($KeyManagementServiceLookupDomain)) {Write-Host " KMS SRV record lookup domain: $KeyManagementServiceLookupDomain"}
|
||||
if ($null -NE $DiscoveredKeyManagementServiceMachineIpAddress) {CONOUT " KMS machine IP address: $DiscoveredKeyManagementServiceMachineIpAddress"}
|
||||
CONOUT " KMS machine extended PID: $KeyManagementServiceProductKeyID"
|
||||
CONOUT " Activation interval: $VLActivationInterval minutes"
|
||||
CONOUT " Renewal interval: $VLRenewalInterval minutes"
|
||||
if ($null -NE $KeyManagementServiceHostCaching) {CONOUT " KMS host caching: $KeyManagementServiceHostCaching"}
|
||||
if (-Not [String]::IsNullOrEmpty($KeyManagementServiceLookupDomain)) {CONOUT " KMS SRV record lookup domain: $KeyManagementServiceLookupDomain"}
|
||||
}
|
||||
|
||||
function GetResult($strSLP, $strSLS, $strID)
|
||||
{
|
||||
try {$objPrd = Get-WmiObject $strSLP -Filter "ID='$strID'" -EA 1} catch {return}
|
||||
$objPrd | select -Expand Properties -EA 0 | foreach {
|
||||
if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value}
|
||||
try
|
||||
{
|
||||
$objPrd = [wmisearcher]"SELECT * FROM $strSLP WHERE ID='$strID'"
|
||||
$objPrd.Options.Rewindable = $false
|
||||
$objPrd.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value} }
|
||||
$objPrd.Dispose()
|
||||
}
|
||||
catch
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
$winID = ($ApplicationID -EQ $winApp)
|
||||
$winPR = ($winID -And -Not $LicenseIsAddon)
|
||||
$Vista = ($winID -And $NT6 -And -Not $NT7)
|
||||
$NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001)
|
||||
$reapp = ("Windows", "App")[!$winID]
|
||||
$prmnt = ("machine", "product")[!$winPR]
|
||||
|
||||
if ($Description | Select-String "VOLUME_KMSCLIENT") {$cKmsClient = 1; $_mTag = "Volume"}
|
||||
if ($Description | Select-String "TIMEBASED_") {$cTblClient = 1; $_mTag = "Timebased"}
|
||||
@ -403,7 +456,7 @@ function GetResult($strSLP, $strSLS, $strID)
|
||||
$LicenseInf = "Licensed"
|
||||
$LicenseMsg = $null
|
||||
if ($GracePeriodRemaining -EQ 0) {
|
||||
if ($winPR) {$ExpireMsg = "The machine is permanently activated."} else {$ExpireMsg = "The product is permanently activated."}
|
||||
$ExpireMsg = "The $prmnt is permanently activated."
|
||||
} else {
|
||||
$LicenseMsg = "$_mTag activation expiration: $GracePeriodRemaining minute(s) ($_gpr day(s))"
|
||||
if ($null -NE $_xpr) {$ExpireMsg = "$_mTag activation will expire $_xpr"}
|
||||
@ -424,8 +477,9 @@ function GetResult($strSLP, $strSLS, $strID)
|
||||
if ($LicenseStatus -EQ 5 -And -Not $NT5) {
|
||||
$LicenseInf = "Notification"
|
||||
$LicenseMsg = "Notification Reason: $LicenseReason"
|
||||
if ($LicenseReason -EQ "0xC004F00F") {if ($null -NE $cKmsClient) {$LicenseMsg = $LicenseMsg + " (KMS license expired)."} else {$LicenseMsg = $LicenseMsg + " (hardware out of tolerance)."}}
|
||||
if ($LicenseReason -EQ "0xC004F200") {$LicenseMsg = $LicenseMsg + " (non-genuine)."}
|
||||
if ($LicenseReason -EQ "0xC004F009") {$LicenseMsg = $LicenseMsg + " (grace time expired)."}
|
||||
if ($LicenseReason -EQ "0xC004F009" -Or $LicenseReason -EQ "0xC004F064") {$LicenseMsg = $LicenseMsg + " (grace time expired)."}
|
||||
}
|
||||
if ($LicenseStatus -GT 5 -Or ($LicenseStatus -GT 4 -And $NT5)) {
|
||||
$LicenseInf = "Unknown"
|
||||
@ -437,25 +491,61 @@ function GetResult($strSLP, $strSLS, $strID)
|
||||
}
|
||||
|
||||
if ($winPR -And $PartialProductKey -And -Not $NT9) {
|
||||
$dp4 = Get-ItemProperty -EA 0 "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | select -EA 0 -Expand DigitalProductId4
|
||||
$dp4 = strGetRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "DigitalProductId4"
|
||||
if ($null -NE $dp4) {
|
||||
$ProductKeyChannel = ([System.Text.Encoding]::Unicode.GetString($dp4, 1016, 128)).Trim([char]$null)
|
||||
}
|
||||
}
|
||||
|
||||
if ($All.IsPresent) {Write-Host}
|
||||
Write-Host "Name: $Name"
|
||||
Write-Host "Description: $Description"
|
||||
Write-Host "Activation ID: $ID"
|
||||
if ($null -NE $ProductKeyID) {Write-Host "Extended PID: $ProductKeyID"}
|
||||
if ($null -NE $OfflineInstallationId -And $IID.IsPresent) {Write-Host "Installation ID: $OfflineInstallationId"}
|
||||
if ($null -NE $ProductKeyChannel) {Write-Host "Product Key Channel: $ProductKeyChannel"}
|
||||
if ($null -NE $PartialProductKey) {Write-Host "Partial Product Key: $PartialProductKey"} else {Write-Host "Product Key: Not installed"}
|
||||
Write-Host "License Status: $LicenseInf"
|
||||
if ($null -NE $LicenseMsg) {Write-Host "$LicenseMsg"}
|
||||
if ($winPR -And $Dlv -And $NT7 -And $null -EQ $RemainingAppReArmCount) {
|
||||
try
|
||||
{
|
||||
$tmp = [wmisearcher]"SELECT RemainingWindowsReArmCount FROM $strSLS"
|
||||
$tmp.Options.Rewindable = $false
|
||||
$tmp.Get() | select -Expand Properties -EA 0 | foreach {set $_.Name $_.Value}
|
||||
$tmp.Dispose()
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
$add_on = $Name.IndexOf("add-on for", 5)
|
||||
|
||||
& $isAll
|
||||
if ($add_on -EQ -1) {CONOUT "Name: $Name"} else {CONOUT "Name: $($Name.Substring(0, $add_on + 7))"}
|
||||
CONOUT "Description: $Description"
|
||||
CONOUT "Activation ID: $ID"
|
||||
if ($null -NE $ProductKeyID) {CONOUT "Extended PID: $ProductKeyID"}
|
||||
if ($null -NE $ProductKeyID2 -And $Dlv) {CONOUT "Product ID: $ProductKeyID2"}
|
||||
if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"}
|
||||
if ($null -NE $ProductKeyChannel) {CONOUT "Product Key Channel: $ProductKeyChannel"}
|
||||
if ($null -NE $PartialProductKey) {CONOUT "Partial Product Key: $PartialProductKey"}
|
||||
CONOUT "License Status: $LicenseInf"
|
||||
if ($null -NE $LicenseMsg) {CONOUT "$LicenseMsg"}
|
||||
if ($LicenseStatus -NE 0 -And $EvaluationEndDate.Substring(0,4) -NE "1601") {
|
||||
$EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($EvaluationEndDate),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt')
|
||||
Write-Host "Evaluation End Date: $EED UTC"
|
||||
CONOUT "Evaluation End Date: $EED UTC"
|
||||
}
|
||||
if ($Dlv) {
|
||||
if ($null -NE $RemainingWindowsReArmCount) {
|
||||
CONOUT "Remaining Windows rearm count: $RemainingWindowsReArmCount"
|
||||
}
|
||||
if ($null -NE $RemainingSkuReArmCount -And $RemainingSkuReArmCount -NE 4294967295) {
|
||||
CONOUT "Remaining $reapp rearm count: $RemainingAppReArmCount"
|
||||
CONOUT "Remaining SKU rearm count: $RemainingSkuReArmCount"
|
||||
}
|
||||
if ($null -NE $TrustedTime -And $LicenseStatus -NE 0) {
|
||||
$TTD = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($TrustedTime),$null,32).ToString('yyyy-MM-dd hh:mm:ss tt')
|
||||
CONOUT "Trusted time: $TTD"
|
||||
}
|
||||
}
|
||||
if ($LicenseStatus -EQ 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if ($strSLP -EQ $wslp -And $null -NE $PartialProductKey -And $null -NE $ADActivationObjectName -And $VLActivationType -EQ 1) {
|
||||
DetectAdbaClient
|
||||
}
|
||||
|
||||
if ($winID -And $null -NE $cAvmClient -And $null -NE $PartialProductKey) {
|
||||
@ -467,16 +557,22 @@ function GetResult($strSLP, $strSLS, $strID)
|
||||
$chkSLS = ($null -NE $PartialProductKey) -And ($null -NE $cKmsClient -Or $null -NE $cKmsHost -Or $chkSub)
|
||||
|
||||
if (!$chkSLS) {
|
||||
if ($null -NE $ExpireMsg) {Write-Host; Write-Host " $ExpireMsg"}
|
||||
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
|
||||
return
|
||||
}
|
||||
|
||||
$objSvc = Get-WmiObject $strSLS -EA 0
|
||||
|
||||
if ($Vista) {
|
||||
$objSvc | select -Expand Properties -EA 0 | foreach {
|
||||
if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value}
|
||||
}
|
||||
try
|
||||
{
|
||||
$objSvc = New-Object PSObject
|
||||
$wmiSvc = [wmisearcher]"SELECT * FROM $strSLS"
|
||||
$wmiSvc.Options.Rewindable = $false
|
||||
$wmiSvc.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {$objSvc | Add-Member 8 $_.Name $_.Value} }
|
||||
$wmiSvc.Dispose()
|
||||
if ($null -EQ $IsKeyManagementServiceMachine) {$objSvc.PSObject.Properties | foreach {set $_.Name $_.Value}}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
if ($strSLS -EQ $wsls -And $NT9) {
|
||||
@ -486,6 +582,7 @@ function GetResult($strSLP, $strSLS, $strID)
|
||||
}
|
||||
|
||||
if ($null -NE $cKmsHost -And $IsKeyManagementServiceMachine -GT 0) {
|
||||
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
|
||||
DetectKmsHost
|
||||
}
|
||||
|
||||
@ -493,7 +590,9 @@ function GetResult($strSLP, $strSLS, $strID)
|
||||
DetectKmsClient
|
||||
}
|
||||
|
||||
if ($null -NE $ExpireMsg) {Write-Host; Write-Host " $ExpireMsg"}
|
||||
if ($null -EQ $cKmsHost) {
|
||||
if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"}
|
||||
}
|
||||
|
||||
if ($chkSub) {
|
||||
DetectSubscription
|
||||
@ -533,11 +632,10 @@ function PrintModePerPridFromRegistry
|
||||
$vNextPrids = Get-Item -Path $vNextRegkey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'property' -ErrorAction SilentlyContinue | Where-Object -FilterScript {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}
|
||||
If ($null -Eq $vNextPrids)
|
||||
{
|
||||
Write-Host
|
||||
Write-Host "No registry keys found."
|
||||
CONOUT "`nNo registry keys found."
|
||||
Return
|
||||
}
|
||||
Write-Host
|
||||
CONOUT "`r"
|
||||
$vNextPrids | ForEach `
|
||||
{
|
||||
$mode = (Get-ItemProperty -Path $vNextRegkey -Name $_).$_
|
||||
@ -547,7 +645,7 @@ function PrintModePerPridFromRegistry
|
||||
3 { $mode = "Device"; Break }
|
||||
Default { $mode = "Legacy"; Break }
|
||||
}
|
||||
Write-Host $_ = $mode
|
||||
CONOUT "$_ = $mode"
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,8 +659,7 @@ function PrintSharedComputerLicensing
|
||||
$scaPolicyValue = Get-ItemProperty -Path $scaPolicyKey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction SilentlyContinue
|
||||
If ($null -Eq $scaValue -And $null -Eq $scaValue2 -And $null -Eq $scaPolicyValue)
|
||||
{
|
||||
Write-Host
|
||||
Write-Host "No registry keys found."
|
||||
CONOUT "`nNo registry keys found."
|
||||
Return
|
||||
}
|
||||
$scaModeValue = $scaValue -Or $scaValue2 -Or $scaPolicyValue
|
||||
@ -574,23 +671,17 @@ function PrintSharedComputerLicensing
|
||||
{
|
||||
$scaMode = "Enabled"
|
||||
}
|
||||
Write-Host
|
||||
Write-Host "Status:" $scaMode
|
||||
Write-Host
|
||||
CONOUT "`nStatus: $scaMode"
|
||||
CONOUT "`r"
|
||||
$tokenFiles = $null
|
||||
$tokenPath = "${env:LOCALAPPDATA}\Microsoft\Office\16.0\Licensing"
|
||||
If (Test-Path $tokenPath)
|
||||
{
|
||||
$tokenFiles = Get-ChildItem -Path $tokenPath -Filter "*authString*" -Recurse | Where-Object { !$_.PSIsContainer }
|
||||
}
|
||||
If ($null -Eq $tokenFiles)
|
||||
If ($null -Eq $tokenFiles -Or $tokenFiles.Length -Eq 0)
|
||||
{
|
||||
Write-Host "No tokens found."
|
||||
Return
|
||||
}
|
||||
If ($tokenFiles.Length -Eq 0)
|
||||
{
|
||||
Write-Host "No tokens found."
|
||||
CONOUT "No tokens found."
|
||||
Return
|
||||
}
|
||||
$tokenFiles | ForEach `
|
||||
@ -624,16 +715,9 @@ function PrintLicensesInformation
|
||||
{
|
||||
$licenseFiles = Get-ChildItem -Path $licensePath -Recurse | Where-Object { !$_.PSIsContainer }
|
||||
}
|
||||
If ($null -Eq $licenseFiles)
|
||||
If ($null -Eq $licenseFiles -Or $licenseFiles.Length -Eq 0)
|
||||
{
|
||||
Write-Host
|
||||
Write-Host "No licenses found."
|
||||
Return
|
||||
}
|
||||
If ($licenseFiles.Length -Eq 0)
|
||||
{
|
||||
Write-Host
|
||||
Write-Host "No licenses found."
|
||||
CONOUT "`nNo licenses found."
|
||||
Return
|
||||
}
|
||||
$licenseFiles | ForEach `
|
||||
@ -690,24 +774,20 @@ function vNextDiagRun
|
||||
Return
|
||||
}
|
||||
|
||||
if ($All.IsPresent) {Write-Host}
|
||||
Write-Host "$line2"
|
||||
Write-Host "=== Office vNext Status ==="
|
||||
Write-Host "$line2"
|
||||
Write-Host
|
||||
Write-Host "========== Mode per ProductReleaseId =========="
|
||||
& $isAll
|
||||
CONOUT "$line2"
|
||||
CONOUT "=== Office vNext Status ==="
|
||||
CONOUT "$line2"
|
||||
CONOUT "`n========== Mode per ProductReleaseId =========="
|
||||
PrintModePerPridFromRegistry
|
||||
Write-Host
|
||||
Write-Host "========== Shared Computer Licensing =========="
|
||||
CONOUT "`n========== Shared Computer Licensing =========="
|
||||
PrintSharedComputerLicensing
|
||||
Write-Host
|
||||
Write-Host "========== vNext licenses ==========="
|
||||
CONOUT "`n========== vNext licenses ==========="
|
||||
PrintLicensesInformation -Mode "NUL"
|
||||
Write-Host
|
||||
Write-Host "========== Device licenses =========="
|
||||
CONOUT "`n========== Device licenses =========="
|
||||
PrintLicensesInformation -Mode "Device"
|
||||
Write-Host "$line3"
|
||||
Write-Host
|
||||
CONOUT "$line3"
|
||||
CONOUT "`r"
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -790,13 +870,13 @@ function PrintStateData {
|
||||
}
|
||||
|
||||
[string[]]$pwszStateString = $Marshal::PtrToStringUni($pwszStateData) -replace ";", "`n "
|
||||
Write-Host " $pwszStateString"
|
||||
CONOUT (" $pwszStateString")
|
||||
|
||||
$Marshal::FreeHGlobal($pwszStateData)
|
||||
return $TRUE
|
||||
}
|
||||
|
||||
function PrintLastActivationHRresult {
|
||||
function PrintLastActivationHResult {
|
||||
$pdwLastHResult = 0
|
||||
$cbSize = 0
|
||||
|
||||
@ -809,12 +889,34 @@ function PrintLastActivationHRresult {
|
||||
return $FALSE
|
||||
}
|
||||
|
||||
Write-Host (" LastActivationHResult=0x{0:x8}" -f $Marshal::ReadInt32($pdwLastHResult))
|
||||
CONOUT (" LastActivationHResult=0x{0:x8}" -f $Marshal::ReadInt32($pdwLastHResult))
|
||||
|
||||
$Marshal::FreeHGlobal($pdwLastHResult)
|
||||
return $TRUE
|
||||
}
|
||||
|
||||
function PrintLastActivationTime {
|
||||
$pdwLastTime = 0
|
||||
$cbSize = 0
|
||||
|
||||
if ($Win32::SLGetWindowsInformation(
|
||||
"Security-SPP-LastWindowsActivationTime",
|
||||
[ref]$null,
|
||||
[ref]$cbSize,
|
||||
[ref]$pdwLastTime
|
||||
)) {
|
||||
return $FALSE
|
||||
}
|
||||
|
||||
$actTime = $Marshal::ReadInt64($pdwLastTime)
|
||||
if ($actTime -ne 0) {
|
||||
CONOUT (" LastActivationTime={0}" -f [DateTime]::FromFileTimeUtc($actTime).ToString("yyyy/MM/dd:HH:mm:ss"))
|
||||
}
|
||||
|
||||
$Marshal::FreeHGlobal($pdwLastTime)
|
||||
return $TRUE
|
||||
}
|
||||
|
||||
function PrintIsWindowsGenuine {
|
||||
$dwGenuine = 0
|
||||
$ppwszGenuineStates = @(
|
||||
@ -830,9 +932,9 @@ function PrintIsWindowsGenuine {
|
||||
}
|
||||
|
||||
if ($dwGenuine -lt 5) {
|
||||
Write-Host (" IsWindowsGenuine={0}" -f $ppwszGenuineStates[$dwGenuine])
|
||||
CONOUT (" IsWindowsGenuine={0}" -f $ppwszGenuineStates[$dwGenuine])
|
||||
} else {
|
||||
Write-Host (" IsWindowsGenuine={0}" -f $dwGenuine)
|
||||
CONOUT (" IsWindowsGenuine={0}" -f $dwGenuine)
|
||||
}
|
||||
|
||||
return $TRUE
|
||||
@ -856,7 +958,7 @@ function PrintDigitalLicenseStatus {
|
||||
[bool]$bDigitalLicense = $FALSE
|
||||
|
||||
$bDigitalLicense = (($dwReturnCode -ge 0) -and ($dwReturnCode -ne 1))
|
||||
Write-Host (" IsDigitalLicense={0}" -f (BoolToWStr $bDigitalLicense))
|
||||
CONOUT (" IsDigitalLicense={0}" -f (BoolToWStr $bDigitalLicense))
|
||||
|
||||
return $TRUE
|
||||
}
|
||||
@ -874,7 +976,7 @@ function PrintSubscriptionStatus {
|
||||
return $FALSE
|
||||
}
|
||||
|
||||
Write-Host (" SubscriptionSupportedEdition={0}" -f (BoolToWStr $dwSupported))
|
||||
CONOUT (" SubscriptionSupportedEdition={0}" -f (BoolToWStr $dwSupported))
|
||||
|
||||
$pStatus = $Marshal::AllocHGlobal($Marshal::SizeOf([Type]$SubStatus))
|
||||
if ($Win32::ClipGetSubscriptionStatus([ref]$pStatus)) {
|
||||
@ -885,25 +987,26 @@ function PrintSubscriptionStatus {
|
||||
$sStatus = $Marshal::PtrToStructure($pStatus, [Type]$SubStatus)
|
||||
$Marshal::FreeHGlobal($pStatus)
|
||||
|
||||
Write-Host (" SubscriptionEnabled={0}" -f (BoolToWStr $sStatus.dwEnabled))
|
||||
CONOUT (" SubscriptionEnabled={0}" -f (BoolToWStr $sStatus.dwEnabled))
|
||||
|
||||
if ($sStatus.dwEnabled -eq 0) {
|
||||
return $TRUE
|
||||
}
|
||||
|
||||
Write-Host (" SubscriptionSku={0}" -f $sStatus.dwSku)
|
||||
Write-Host (" SubscriptionState={0}" -f $sStatus.dwState)
|
||||
CONOUT (" SubscriptionSku={0}" -f $sStatus.dwSku)
|
||||
CONOUT (" SubscriptionState={0}" -f $sStatus.dwState)
|
||||
|
||||
return $TRUE
|
||||
}
|
||||
|
||||
function ClicRun
|
||||
{
|
||||
if ($All.IsPresent) {Write-Host}
|
||||
Write-Host "Client Licensing Check information:"
|
||||
& $isAll
|
||||
CONOUT "Client Licensing Check information:"
|
||||
|
||||
$null = PrintStateData
|
||||
$null = PrintLastActivationHRresult
|
||||
$null = PrintLastActivationHResult
|
||||
$null = PrintLastActivationTime
|
||||
$null = PrintIsWindowsGenuine
|
||||
|
||||
if ($DllDigital) {
|
||||
@ -914,15 +1017,15 @@ function ClicRun
|
||||
$null = PrintSubscriptionStatus
|
||||
}
|
||||
|
||||
Write-Host "$line3"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line3"
|
||||
& $noAll
|
||||
}
|
||||
#endregion
|
||||
|
||||
$Host.UI.RawUI.WindowTitle = "Check Activation Status"
|
||||
|
||||
if ($All.IsPresent) {
|
||||
$B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B;clear;
|
||||
$B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B;
|
||||
if (!$Pass.IsPresent) {clear;}
|
||||
}
|
||||
|
||||
$SysPath = "$env:SystemRoot\System32"
|
||||
@ -941,46 +1044,43 @@ $cSub = ($winbuild -GE 19041) -And (Select-String -Path "$SysPath\wbem\sppwmi.mo
|
||||
$DllDigital = ($winbuild -GE 14393) -And (Test-Path "$SysPath\EditionUpgradeManagerObj.dll")
|
||||
$DllSubscription = ($winbuild -GE 14393) -And (Test-Path "$SysPath\Clipc.dll")
|
||||
$VLActTypes = @("All", "AD", "KMS", "Token")
|
||||
$SLKeyPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||
$NSKeyPath = "Registry::HKEY_USERS\S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||
$SLKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||
$NSKeyPath = "HKEY_USERS\S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||
|
||||
'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ $null}
|
||||
'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ $false}
|
||||
|
||||
$OsppHook = 1
|
||||
try {gsv osppsvc -EA 1 | Out-Null} catch {$OsppHook = 0}
|
||||
$offsvc = "osppsvc"
|
||||
if ($NT7 -Or -Not $NT6) {$winsvc = "sppsvc"} else {$winsvc = "slsvc"}
|
||||
|
||||
if ($NT7 -Or -Not $NT6) {
|
||||
try {sasv sppsvc -EA 1} catch {}
|
||||
try {gsv $winsvc -EA 1 | Out-Null; $WsppHook = 1} catch {$WsppHook = 0}
|
||||
try {gsv $offsvc -EA 1 | Out-Null; $OsppHook = 1} catch {$OsppHook = 0}
|
||||
|
||||
if ($WsppHook -NE 0) {
|
||||
try {sasv $winsvc -EA 1} catch {}
|
||||
$cW1nd0ws = DetectID $wslp $winApp
|
||||
$c0ff1ce15 = DetectID $wslp $o15App
|
||||
$c0ff1ce14 = DetectID $wslp $o14App
|
||||
}
|
||||
else
|
||||
{
|
||||
try {sasv slsvc -EA 1} catch {}
|
||||
}
|
||||
|
||||
DetectID $wslp $winApp ([ref]$cW1nd0ws)
|
||||
DetectID $wslp $o15App ([ref]$c0ff1ce15)
|
||||
DetectID $wslp $o14App ([ref]$c0ff1ce14)
|
||||
|
||||
if ($OsppHook -NE 0) {
|
||||
try {sasv osppsvc -EA 1} catch {}
|
||||
DetectID $oslp $o15App ([ref]$ospp15)
|
||||
DetectID $oslp $o14App ([ref]$ospp14)
|
||||
try {sasv $offsvc -EA 1} catch {}
|
||||
$ospp15 = DetectID $oslp $o15App
|
||||
$ospp14 = DetectID $oslp $o14App
|
||||
}
|
||||
|
||||
if ($null -NE $cW1nd0ws)
|
||||
if ($cW1nd0ws)
|
||||
{
|
||||
echoWindows
|
||||
GetID $wslp $winApp | foreach -EA 1 {
|
||||
GetResult $wslp $wsls $_
|
||||
Write-Host "$line3"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line3"
|
||||
& $noAll
|
||||
}
|
||||
}
|
||||
elseif ($NT6)
|
||||
{
|
||||
echoWindows
|
||||
Write-Host
|
||||
Write-Host "Error: product key not found."
|
||||
CONOUT "`nError: product key not found."
|
||||
}
|
||||
|
||||
if ($winbuild -GE 9200) {
|
||||
@ -994,39 +1094,43 @@ if ($c0ff1ce15 -Or $ospp15) {
|
||||
|
||||
$doMSG = 1
|
||||
|
||||
if ($null -NE $c0ff1ce15) {
|
||||
if ($c0ff1ce15)
|
||||
{
|
||||
echoOffice
|
||||
GetID $wslp $o15App | foreach -EA 1 {
|
||||
GetResult $wslp $wsls $_
|
||||
Write-Host "$line3"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line3"
|
||||
& $noAll
|
||||
}
|
||||
}
|
||||
|
||||
if ($null -NE $c0ff1ce14) {
|
||||
if ($c0ff1ce14)
|
||||
{
|
||||
echoOffice
|
||||
GetID $wslp $o14App | foreach -EA 1 {
|
||||
GetResult $wslp $wsls $_
|
||||
Write-Host "$line3"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line3"
|
||||
& $noAll
|
||||
}
|
||||
}
|
||||
|
||||
if ($null -NE $ospp15) {
|
||||
if ($ospp15)
|
||||
{
|
||||
echoOffice
|
||||
GetID $oslp $o15App | foreach -EA 1 {
|
||||
GetResult $oslp $osls $_
|
||||
Write-Host "$line3"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line3"
|
||||
& $noAll
|
||||
}
|
||||
}
|
||||
|
||||
if ($null -NE $ospp14) {
|
||||
if ($ospp14)
|
||||
{
|
||||
echoOffice
|
||||
GetID $oslp $o14App | foreach -EA 1 {
|
||||
GetResult $oslp $osls $_
|
||||
Write-Host "$line3"
|
||||
if (!$All.IsPresent) {Write-Host}
|
||||
CONOUT "$line3"
|
||||
& $noAll
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@set masver=3.0
|
||||
@echo off
|
||||
|
||||
|
||||
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
@ -67,7 +69,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@ -82,7 +84,7 @@ echo:
|
||||
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 Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@ -103,6 +105,8 @@ set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
@ -118,6 +122,16 @@ call :dk_setvar
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -157,32 +171,6 @@ 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 || (
|
||||
@ -195,6 +183,48 @@ goto done2
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
echo %tstresult%
|
||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
%eline%
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@ -215,6 +245,7 @@ if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
@ -240,9 +271,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@ -258,7 +299,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@ -299,6 +340,7 @@ set HWID_Activation.cmd=Activators\HWID_Activation.cmd
|
||||
set KMS38_Activation.cmd=Activators\KMS38_Activation.cmd
|
||||
set Online_KMS_Activation.cmd=Activators\Online_KMS_Activation.cmd
|
||||
set Ohook_Activation_AIO.cmd=Activators\Ohook_Activation_AIO.cmd
|
||||
set TSforge_Activation.cmd=Activators\TSforge_Activation.cmd
|
||||
pushd "!_work!"
|
||||
|
||||
set _nofile=
|
||||
@ -307,6 +349,7 @@ for %%# in (
|
||||
%KMS38_Activation.cmd%
|
||||
%Online_KMS_Activation.cmd%
|
||||
%Ohook_Activation_AIO.cmd%
|
||||
%TSforge_Activation.cmd%
|
||||
) do (
|
||||
if not exist "%%#" set _nofile=1
|
||||
)
|
||||
@ -332,36 +375,34 @@ echo:
|
||||
echo:
|
||||
echo:
|
||||
echo: Extract $OEM$ folder on the desktop
|
||||
echo: ________________________________________________________
|
||||
echo: ____________________________________________________________
|
||||
echo:
|
||||
echo: [1] HWID
|
||||
echo: [2] Ohook
|
||||
echo: [3] KMS38
|
||||
echo: [4] Online KMS
|
||||
echo: [1] HWID [Windows]
|
||||
echo: [2] Ohook [Office]
|
||||
echo: [3] TSforge [Windows / ESU / Office]
|
||||
echo: [4] KMS38 [Windows]
|
||||
echo: [5] Online KMS [Windows / Office]
|
||||
echo:
|
||||
echo: [5] HWID ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo: [6] HWID ^(Windows^) ^+ Online KMS ^(Office^)
|
||||
echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
|
||||
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo: [6] HWID [Windows] ^+ Ohook [Office]
|
||||
echo: [7] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
|
||||
echo: [8] TSforge [Windows] ^+ Online KMS [Office]
|
||||
echo:
|
||||
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
echo: [0] Exit
|
||||
echo: ________________________________________________________
|
||||
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
echo: [0] Exit
|
||||
echo: ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
|
||||
choice /C:123456789R0 /N
|
||||
choice /C:12345678R0 /N
|
||||
set _erl=%errorlevel%
|
||||
|
||||
if %_erl%==11 exit /b
|
||||
if %_erl%==10 start %mas%oem-folder &goto :Menu
|
||||
if %_erl%==9 goto:kms_ohook
|
||||
if %_erl%==8 goto:kms38_kms
|
||||
if %_erl%==7 goto:kms38_ohook
|
||||
if %_erl%==6 goto:hwid_kms
|
||||
if %_erl%==5 goto:hwid_ohook
|
||||
if %_erl%==4 goto:kms
|
||||
if %_erl%==3 goto:kms38
|
||||
if %_erl%==10 exit /b
|
||||
if %_erl%==9 start %mas%oem-folder &goto :Menu
|
||||
if %_erl%==8 goto:tsforge_kms
|
||||
if %_erl%==7 goto:hwid_ohook_tsforge
|
||||
if %_erl%==6 goto:hwid_ohook
|
||||
if %_erl%==5 goto:kms
|
||||
if %_erl%==4 goto:kms38
|
||||
if %_erl%==3 goto:tsforge
|
||||
if %_erl%==2 goto:ohook
|
||||
if %_erl%==1 goto:hwid
|
||||
goto :Menu
|
||||
@ -428,6 +469,36 @@ cd \
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:tsforge
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export tsforge_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=TSforge
|
||||
goto done
|
||||
|
||||
:tsforge_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-WindowsESUOffice
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:tsforge_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms38
|
||||
|
||||
cls
|
||||
@ -526,26 +597,28 @@ cd \
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:hwid_kms
|
||||
:hwid_ohook_tsforge
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export hwid_kms_setup
|
||||
call :export hwid_ohook_tsforge_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\HWID_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=HWID [Windows] + Online KMS [Office]
|
||||
set oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]
|
||||
goto done
|
||||
|
||||
:hwid_kms_setup:
|
||||
:hwid_ohook_tsforge_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
@ -554,80 +627,46 @@ setlocal
|
||||
call "%~dp0HWID_Activation.cmd" /HWID
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Office
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:hwid_kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms38_ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export kms38_ohook_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\KMS38_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=KMS38 [Windows] + Ohook [Office]
|
||||
goto done
|
||||
|
||||
:kms38_ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0KMS38_Activation.cmd" /KMS38
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-ESU
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms38_ohook_setup:
|
||||
:hwid_ohook_tsforge_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms38_kms
|
||||
:tsforge_kms
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %nul%
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export kms38_kms_setup
|
||||
call :export tsforge_kms_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\KMS38_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=KMS38 [Windows] + Online KMS [Office]
|
||||
set oem=TSforge [Windows] + Online KMS [Office]
|
||||
goto done
|
||||
|
||||
:kms38_kms_setup:
|
||||
:tsforge_kms_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0KMS38_Activation.cmd" /KMS38
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-Windows
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
@ -636,45 +675,7 @@ endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms38_kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms_ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export kms_ohook_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=Online KMS [Windows] + Ohook [Office]
|
||||
goto done
|
||||
|
||||
:kms_ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Windows
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms_ohook_setup:
|
||||
:tsforge_kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@ -692,7 +693,7 @@ call :dk_color %Blue% "%oem%"
|
||||
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
|
||||
echo "%oem%" | find /i "38" %nul% && (
|
||||
echo:
|
||||
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
|
||||
echo To KMS38 activate Server Cor/Acor editions [No GUI Versions],
|
||||
echo Check this page %mas%oem-folder
|
||||
)
|
||||
echo ______________________________________________________________
|
||||
@ -701,7 +702,8 @@ echo ______________________________________________________________
|
||||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
@ -729,12 +731,15 @@ set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@ -744,6 +749,7 @@ set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@set masver=3.0
|
||||
@echo off
|
||||
|
||||
|
||||
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
@ -67,7 +69,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@ -82,7 +84,7 @@ echo:
|
||||
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 Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@ -103,6 +105,8 @@ set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
@ -119,6 +123,16 @@ set "line=______________________________________________________________________
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
@ -158,32 +172,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: 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 dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@ -196,6 +184,48 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
echo %tstresult%
|
||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
%eline%
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@ -216,6 +246,7 @@ if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
@ -241,9 +272,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@ -259,7 +300,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@ -461,7 +502,7 @@ goto :at_back
|
||||
cls
|
||||
if not defined terminal (
|
||||
mode 125, 32
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||
)
|
||||
title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^)
|
||||
|
||||
@ -547,7 +588,7 @@ echo Deleting a Volatile ^& Protected Registry Key...
|
||||
echo [%RegKey%]
|
||||
reg query "%RegKey%" %nul% && (
|
||||
call :dk_color %Red% "[Failed]"
|
||||
echo Restart your system, that will delete this registry key automatically.
|
||||
echo Reboot your machine using the restart option, that will delete this registry key automatically.
|
||||
) || (
|
||||
echo [Successful]
|
||||
)
|
||||
@ -593,7 +634,7 @@ echo [Successful]
|
||||
|
||||
echo:
|
||||
echo Restarting wlidsvc ^& LicenseManager services...
|
||||
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
|
||||
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@ -784,14 +825,6 @@ echo:
|
||||
call :dk_color %Blue% "Repairing Office licenses..."
|
||||
echo:
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b
|
||||
|
||||
if /i "%arch%"=="x86" (
|
||||
set arch=X86
|
||||
) else (
|
||||
set arch=X64
|
||||
)
|
||||
|
||||
for %%# in (68 86) do (
|
||||
for %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%%#=)
|
||||
)
|
||||
@ -809,10 +842,10 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v P
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16)
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & call :getc2rrepair c2r16repair86 OfficeClickToRun.exe)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & call :getc2rrepair c2r16repair68 OfficeClickToRun.exe)
|
||||
|
||||
set uwp16=
|
||||
if %winbuild% GEQ 10240 (
|
||||
@ -873,11 +906,8 @@ pause %nul1%
|
||||
|
||||
if defined uwp16 (
|
||||
echo:
|
||||
echo Note: Skipping repair for Office 16.0 UWP...
|
||||
echo You need to use the Reset option in Windows Settings instead.
|
||||
echo ________________________________________________________________
|
||||
echo Skipping repair for Office 16.0 UWP...
|
||||
echo:
|
||||
start ms-settings:appsfeatures
|
||||
)
|
||||
|
||||
set c2r14=
|
||||
@ -886,11 +916,8 @@ if defined c2r14_86 set c2r14=1
|
||||
|
||||
if defined c2r14 (
|
||||
echo:
|
||||
echo Note: Skipping repair for Office 14.0 C2R...
|
||||
echo You need to use the Repair option in Windows Settings for it.
|
||||
echo ________________________________________________________________
|
||||
echo Skipping repair for Office 14.0 C2R...
|
||||
echo:
|
||||
start appwiz.cpl
|
||||
)
|
||||
|
||||
if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
|
||||
@ -913,6 +940,15 @@ echo:
|
||||
call :dk_color %Green% "Finished"
|
||||
goto :at_back
|
||||
|
||||
:getc2rrepair
|
||||
|
||||
for %%# in (X86 X64) do (
|
||||
if exist "%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2" (
|
||||
set "%1=%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2"
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
:getrepairsetup
|
||||
|
||||
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
|
||||
@ -1077,7 +1113,7 @@ if %errorlevel% NEQ 0 (set error=1& exit /b)
|
||||
|
||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM SoftwareLicensingService').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||
cmd /c exit /b %errorlevel%
|
||||
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440" %nul1%
|
||||
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440 0x80131501" %nul1%
|
||||
if %errorlevel% EQU 0 set error=1
|
||||
exit /b
|
||||
|
||||
@ -1138,6 +1174,8 @@ exit /b
|
||||
set permerror=
|
||||
if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder"
|
||||
|
||||
if defined ps32onArm exit /b
|
||||
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
@ -1381,7 +1419,8 @@ $key.SetAccessControl($acl)
|
||||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to open Troubleshoot page " %Gray% " Press [0] to ignore"
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
@ -1429,12 +1468,15 @@ set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@ -1444,6 +1486,7 @@ set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
103
README.md
103
README.md
@ -2,61 +2,108 @@
|
||||
|
||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||
|
||||
<p align="center">A Windows and Office activator using HWID / Ohook / KMS38 / Online KMS activation methods, with a focus on open-source code and fewer antivirus detections.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://discord.gg/tVFN4N84PP"><img src="https://img.shields.io/badge/Chat%20with%20us%20on%20Discord--blue?style=social&logo=discord" alt="Chat with us without signup" title="Chat with us without signup"></a>
|
||||
<a href="https://www.reddit.com/r/MAS_Activator"><img src="https://img.shields.io/badge/MAS%20on%20Reddit--orange?style=social&logo=reddit" alt="MAS on Reddit" title="MAS on Reddit"></a>
|
||||
<a href="https://twitter.com/massgravel"><img src="https://img.shields.io/twitter/follow/massgravel" alt="Follow us on X" title="Follow us on X"></a>
|
||||
</p>
|
||||
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
## Download / How to use it?
|
||||
|
||||
### Method 1 - PowerShell (Recommended)
|
||||
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
||||
|
||||
- Right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
|
||||
- Copy and paste the code below and press enter
|
||||
1. Open PowerShell (Not CMD). To do that, right-click on the Windows start menu and select PowerShell or Terminal.
|
||||
2. Copy and paste the code below and press enter
|
||||
```
|
||||
irm https://get.activated.win | iex
|
||||
```
|
||||
or (deprecated, will be retired on Aug 31 2024, use above instead)
|
||||
Alternatively, you can use the following (It will be deprecated in the future.)
|
||||
```
|
||||
irm https://massgrave.dev/get | iex
|
||||
```
|
||||
- You will see the activation options. Follow the on-screen instructions.
|
||||
- That's all.
|
||||
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
|
||||
4. That's all.
|
||||
|
||||
---
|
||||
|
||||
- On older Windows builds you may need to run the below command before,
|
||||
`[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12`
|
||||
- The Powershell method does not work on Windows 7. Use the Method 2 - Traditional instead.
|
||||
- The URL get.activated.win may be blocked by some DNS services because it is a new domain.
|
||||
### Method 2 - Traditional (Windows 7 and later)
|
||||
|
||||
### Method 2 - Traditional
|
||||
<details>
|
||||
<summary>Click here for info</summary>
|
||||
|
||||
- Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Bitbucket](https://bitbucket.org/WindowsAddict/microsoft-activation-scripts)
|
||||
- Right-click on the downloaded zip file and extract
|
||||
- In the extracted folder, find the folder named `All-In-One-Version`
|
||||
- Run the file named `MAS_AIO-CRC32_XXXXXXXX.cmd`
|
||||
- You will see the activation options, follow the on-screen instructions.
|
||||
- That's all.
|
||||
1. Download the file using the links provided below.
|
||||
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
|
||||
or
|
||||
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
|
||||
2. Right-click on the downloaded zip file and extract
|
||||
3. In the extracted folder, find the folder named `All-In-One-Version`
|
||||
4. Run the file named `MAS_AIO.cmd`
|
||||
5. You will see the activation options, follow the on-screen instructions.
|
||||
6. That's all.
|
||||
|
||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches)
|
||||
</details>
|
||||
|
||||
</br>
|
||||
---
|
||||
|
||||
### Not working ❓
|
||||
|
||||
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
|
||||
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
|
||||
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
|
||||
|
||||
---
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
|
||||
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
|
||||
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
|
||||
|
||||
---
|
||||
|
||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
||||
|
||||
```
|
||||
Latest Version: 2.6
|
||||
Release date: 20-Apr-2024
|
||||
Latest Version: 3.0
|
||||
Release date: 14-Feb-2025
|
||||
```
|
||||
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![1.1]][1]
|
||||
[![1.2]][2]
|
||||
[![1.3]][3]
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![1.4]][4]
|
||||
[![1.5]][5]
|
||||
[![1.6]][6]
|
||||
[![1.7]][7]
|
||||
|
||||
</div>
|
||||
|
||||
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
|
||||
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
|
||||
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
|
||||
|
||||
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
||||
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
||||
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
|
||||
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
|
||||
|
||||
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
||||
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
|
||||
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
|
||||
[4]: https://discord.gg/j2yFsV5ZVC
|
||||
[5]: https://www.reddit.com/r/MAS_Activator
|
||||
[6]: https://bsky.app/profile/massgrave.dev
|
||||
[7]: https://twitter.com/massgravel
|
||||
|
||||
---
|
||||
|
||||
<p align="center">Made with Love ❤️</p>
|
||||
|
Reference in New Issue
Block a user