Compare commits
65 Commits
Author | SHA1 | Date | |
---|---|---|---|
70b754657f | |||
8b58696455 | |||
5d47723d07 | |||
2b786e3037 | |||
4451a25e7f | |||
886745f103 | |||
5728ba2686 | |||
ddccc4025f | |||
1567903b09 | |||
f6125eaa5b | |||
07c4fcdc74 | |||
962f7e326a | |||
6f88a4bf90 | |||
dd3d788bfa | |||
3d16fc6a07 | |||
e1b9942223 | |||
53cda879c1 | |||
211835666b | |||
bdb9875a6b | |||
5b694779be | |||
b7c3f9a98a | |||
48fb5fc5fe | |||
d3f2cd8806 | |||
8cdde879b2 | |||
0884271c4f | |||
e752461568 | |||
d14b3b46a0 | |||
819140de46 | |||
fc7e9f019d | |||
36f7291963 | |||
9556ad2cbe | |||
71e575e7b6 | |||
355ccb7f29 | |||
984b384d9e | |||
4ce95f6034 | |||
d59e2b0e6e | |||
54c1729d13 | |||
6a72dce047 | |||
2075ab45bc | |||
6a197b5274 | |||
1b80e556f9 | |||
fd65a85d06 | |||
5da6daa402 | |||
604dc6d53f | |||
eb02caa58c | |||
c8f6bd65e8 | |||
c84e4b181a | |||
1c4e85b3e2 | |||
0c1d091c7e | |||
6b0310e1db | |||
23f382f0e3 | |||
481ed4dbd5 | |||
2f97b1c28a | |||
066b135cfd | |||
64e006703c | |||
8f6377f56b | |||
e60f8ea474 | |||
8d6ea50235 | |||
43fb93c1f4 | |||
b3c1efb54a | |||
e16354561b | |||
068903c63f | |||
56ee68903a | |||
c96c353464 | |||
55cca40d39 |
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# MAS export-ignore
|
||||
# LICENSE export-ignore
|
||||
# README.md export-ignore
|
1
LICENSE
1
LICENSE
@ -672,3 +672,4 @@ may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=2.4
|
||||
@set masver=2.6
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
|
||||
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Email: windowsaddict@protonmail.com
|
||||
@ -160,7 +160,7 @@ goto ced_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix for the special characters limitation in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
@ -194,7 +194,7 @@ goto ced_done
|
||||
%nul1% fltmc || (
|
||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script requires admin privileges.
|
||||
echo This script needs admin rights.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto ced_done
|
||||
)
|
||||
@ -230,7 +230,7 @@ echo ________________________________________________
|
||||
echo You are running outdated version MAS %masver%
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
echo [1] Download Latest MAS
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
@ -282,24 +282,7 @@ goto ced_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check SKU value
|
||||
|
||||
set osSKU=
|
||||
set slcSKU=
|
||||
set wmiSKU=
|
||||
|
||||
if %winbuild% GEQ 14393 (set info=Kernel-BrandingInfo) else (set info=Kernel-ProductInfo)
|
||||
set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 'Public, Static', 1, [int], @([String], [int].MakeByRefType()), 1, 3);
|
||||
set d1=%d1% $Sku = 0; [void]$TypeBuilder.CreateType()::SLGetWindowsInformationDWORD('%info%', [ref]$Sku); $Sku
|
||||
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set slcSKU=%%s)
|
||||
if "%slcSKU%"=="0" set slcSKU=
|
||||
if 1%slcSKU% NEQ +1%slcSKU% set slcSKU=
|
||||
|
||||
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
|
||||
set osSKU=%slcSKU%
|
||||
if not defined osSKU set osSKU=%wmiSKU%
|
||||
call :dk_checksku
|
||||
|
||||
if not defined osSKU (
|
||||
%eline%
|
||||
@ -324,7 +307,7 @@ if not defined osedition (
|
||||
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 a Windows bug in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
if %osSKU%==164 set osedition=ProfessionalEducation
|
||||
if %osSKU%==165 set osedition=ProfessionalEducationN
|
||||
@ -354,7 +337,10 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
|
||||
|
||||
%psc% $ExecutionContext.SessionState.LanguageMode %nul2% | find /i "Full" %nul1% || (
|
||||
%eline%
|
||||
echo PowerShell is not responding properly. Aborting...
|
||||
%psc% $ExecutionContext.SessionState.LanguageMode
|
||||
echo:
|
||||
echo PowerShell is not working. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
echo Check this page for help. %mas%troubleshoot
|
||||
goto ced_done
|
||||
@ -550,8 +536,7 @@ echo:
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%;"
|
||||
timeout /t 3 %nul1%
|
||||
echo:
|
||||
call :dk_color %Blue% "Incase of errors, you must restart your system before trying again."
|
||||
echo Check this page for help. %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this page for help" %_Yellow% " %mas%change_edition_issues"
|
||||
)
|
||||
%line%
|
||||
|
||||
@ -565,13 +550,13 @@ cls
|
||||
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% "$f=[io.file]::ReadAllText('!_batp!') -split ':checkrebootflag\:.*';iex ($f[1]);" | find /i "True" %nul% && (
|
||||
%eline%
|
||||
echo Pending reboot flags found.
|
||||
echo:
|
||||
echo Restart the system and try again.
|
||||
goto ced_done
|
||||
)
|
||||
REM %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':checkrebootflag\:.*';iex ($f[1]);" | find /i "True" %nul% && (
|
||||
REM %eline%
|
||||
REM echo Pending reboot flags found.
|
||||
REM echo:
|
||||
REM echo Restart the system and try again.
|
||||
REM goto ced_done
|
||||
REM )
|
||||
|
||||
echo:
|
||||
if defined dismnotworking call :dk_color %_Yellow% "Note - DISM.exe is not responding."
|
||||
@ -654,6 +639,31 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check SKU value
|
||||
|
||||
:dk_checksku
|
||||
|
||||
set osSKU=
|
||||
set slcSKU=
|
||||
set wmiSKU=
|
||||
set regSKU=
|
||||
|
||||
if %winbuild% GEQ 14393 (set info=Kernel-BrandingInfo) else (set info=Kernel-ProductInfo)
|
||||
set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 'Public, Static', 1, [int], @([String], [int].MakeByRefType()), 1, 3);
|
||||
set d1=%d1% $Sku = 0; [void]$TypeBuilder.CreateType()::SLGetWindowsInformationDWORD('%info%', [ref]$Sku); $Sku
|
||||
for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set slcSKU=%%s)
|
||||
if "%slcSKU%"=="0" set slcSKU=
|
||||
if 1%slcSKU% NEQ +1%slcSKU% set slcSKU=
|
||||
|
||||
for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions" /v OSProductPfn %nul6%') do set "regSKU=%%a"
|
||||
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
|
||||
|
||||
set osSKU=%slcSKU%
|
||||
if not defined osSKU set osSKU=%wmiSKU%
|
||||
if not defined osSKU set osSKU=%regSKU%
|
||||
exit /b
|
||||
|
||||
:: Refresh license status
|
||||
|
||||
:dk_refresh
|
||||
@ -731,8 +741,8 @@ exit /b
|
||||
function Test-PendingReboot
|
||||
{
|
||||
if (Test-Path -Path "$env:windir\WinSxS\pending.xml") { return $true }
|
||||
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return $true }
|
||||
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return $true }
|
||||
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA SilentlyContinue) { return $true }
|
||||
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA SilentlyContinue) { return $true }
|
||||
try {
|
||||
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities"
|
||||
$status = $util.DetermineIfRebootPending()
|
||||
|
@ -1,259 +0,0 @@
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
@cls
|
||||
|
||||
|
||||
|
||||
:: Check-Activation-Status-vbs.cmd
|
||||
:: Written by @abbodi1406
|
||||
:: forums.mydigitallife.net/posts/838808
|
||||
|
||||
|
||||
|
||||
set _args=
|
||||
set _args=%*
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-wow" set _rel1=1
|
||||
if /i "%%A"=="-arm" set _rel2=1
|
||||
)
|
||||
set "_cmdf=%~f0"
|
||||
if exist "%SystemRoot%\Sysnative\cmd.exe" if not defined _rel1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" -wow"
|
||||
exit /b
|
||||
)
|
||||
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 if not defined _rel2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" -arm"
|
||||
exit /b
|
||||
)
|
||||
color 07
|
||||
title Check Activation Status [vbs]
|
||||
set "SysPath=%SystemRoot%\System32"
|
||||
set "Path=%SystemRoot%\System32;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||
set "SysPath=%SystemRoot%\Sysnative"
|
||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||
)
|
||||
|
||||
:: Check LF line ending
|
||||
|
||||
pushd "%~dp0"
|
||||
>nul findstr /v "$" "%~nx0" && (
|
||||
echo:
|
||||
echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
ping 127.0.0.1 -n 6 >nul
|
||||
popd
|
||||
exit /b
|
||||
)
|
||||
popd
|
||||
|
||||
set ohook=
|
||||
for %%# in (15 16) do (
|
||||
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
|
||||
if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set ohook=1
|
||||
)
|
||||
)
|
||||
|
||||
for %%# in (System SystemX86) do (
|
||||
for %%G in ("Office 15" "Office") do (
|
||||
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
|
||||
if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" set ohook=1
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set "_bit=64"
|
||||
set "_wow=1"
|
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" set "_wow=0"&set "_bit=32"
|
||||
set "_utemp=%TEMP%"
|
||||
set "line2=************************************************************"
|
||||
set "line3=____________________________________________________________"
|
||||
set _sO16vbs=0
|
||||
set _sO15vbs=0
|
||||
if exist "%ProgramFiles%\Microsoft Office\Office15\ospp.vbs" (
|
||||
set _sO15vbs=1
|
||||
) else if exist "%ProgramW6432%\Microsoft Office\Office15\ospp.vbs" (
|
||||
set _sO15vbs=1
|
||||
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs" (
|
||||
set _sO15vbs=1
|
||||
)
|
||||
setlocal EnableDelayedExpansion
|
||||
echo %line2%
|
||||
echo *** Windows Status ***
|
||||
echo %line2%
|
||||
pushd "!_utemp!"
|
||||
copy /y %SystemRoot%\System32\slmgr.vbs . >nul 2>&1
|
||||
net start sppsvc /y >nul 2>&1
|
||||
cscript //nologo slmgr.vbs /dli || (echo Error executing slmgr.vbs&del /f /q slmgr.vbs&popd&goto :casVend)
|
||||
cscript //nologo slmgr.vbs /xpr
|
||||
del /f /q slmgr.vbs >nul 2>&1
|
||||
popd
|
||||
echo %line3%
|
||||
|
||||
if defined ohook (
|
||||
echo.
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office Ohook Activation Status ***
|
||||
echo %line2%
|
||||
echo.
|
||||
powershell "write-host -back 'Black' -fore 'Yellow' 'Ohook for permanent Office activation is installed.'; write-host -back 'Black' -fore 'Yellow' 'You can ignore below Office activation status.'"
|
||||
echo.
|
||||
)
|
||||
|
||||
:casVo16
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
set _sO16vbs=1
|
||||
echo.
|
||||
echo %line2%
|
||||
if %_sO15vbs% EQU 0 (
|
||||
echo *** Office 2016 %_bit%-bit Status ***
|
||||
) else (
|
||||
echo *** Office 2013/2016 Status ***
|
||||
)
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
if %_wow%==0 goto :casVo13
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
set _sO16vbs=1
|
||||
echo.
|
||||
echo %line2%
|
||||
if %_sO15vbs% EQU 0 (
|
||||
echo *** Office 2016 32-bit Status ***
|
||||
) else (
|
||||
echo *** Office 2013/2016 Status ***
|
||||
)
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
|
||||
:casVo13
|
||||
if %_sO16vbs% EQU 1 goto :casVo10
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office 2013 %_bit%-bit Status ***
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
if %_wow%==0 goto :casVo10
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office 2013 32-bit Status ***
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
|
||||
:casVo10
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office 2010 %_bit%-bit Status ***
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
if %_wow%==0 goto :casVc16
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot /v Path" 2^>nul') do (set "office=%%b")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office 2010 32-bit Status ***
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
|
||||
:casVc16
|
||||
reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath >nul 2>&1 || (
|
||||
reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun /v InstallPath >nul 2>&1 || goto :casVc13
|
||||
)
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (set "office=%%b\Office16")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
set _sO16vbs=1
|
||||
echo.
|
||||
echo %line2%
|
||||
if %_sO15vbs% EQU 0 (
|
||||
echo *** Office 2016-2021 C2R Status ***
|
||||
) else (
|
||||
echo *** Office 2013-2021 Status ***
|
||||
)
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
if %_wow%==0 goto :casVc13
|
||||
set office=
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (set "office=%%b\Office16")
|
||||
if exist "!office!\ospp.vbs" (
|
||||
set _sO16vbs=1
|
||||
echo.
|
||||
echo %line2%
|
||||
if %_sO15vbs% EQU 0 (
|
||||
echo *** Office 2016-2021 C2R Status ***
|
||||
) else (
|
||||
echo *** Office 2013-2021 Status ***
|
||||
)
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
|
||||
:casVc13
|
||||
if %_sO16vbs% EQU 1 goto :casVc10
|
||||
reg query HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun /v InstallPath >nul 2>&1 || (
|
||||
reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\15.0\ClickToRun /v InstallPath >nul 2>&1 || goto :casVc10
|
||||
)
|
||||
set office=
|
||||
if exist "%ProgramFiles%\Microsoft Office\Office15\ospp.vbs" (
|
||||
set "office=%ProgramFiles%\Microsoft Office\Office15"
|
||||
) else if exist "%ProgramW6432%\Microsoft Office\Office15\ospp.vbs" (
|
||||
set "office=%ProgramW6432%\Microsoft Office\Office15"
|
||||
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs" (
|
||||
set "office=%ProgramFiles(x86)%\Microsoft Office\Office15"
|
||||
)
|
||||
if exist "!office!\ospp.vbs" (
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office 2013 C2R Status ***
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
|
||||
:casVc10
|
||||
if %_wow%==0 reg query HKLM\SOFTWARE\Microsoft\Office\14.0\CVH /f Click2run /k >nul 2>&1 || goto :casVend
|
||||
if %_wow%==1 reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\CVH /f Click2run /k >nul 2>&1 || goto :casVend
|
||||
set office=
|
||||
if exist "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" (
|
||||
set "office=%ProgramFiles%\Microsoft Office\Office14"
|
||||
) else if exist "%ProgramW6432%\Microsoft Office\Office14\ospp.vbs" (
|
||||
set "office=%ProgramW6432%\Microsoft Office\Office14"
|
||||
) else if exist "%ProgramFiles(x86)%\Microsoft Office\Office14\ospp.vbs" (
|
||||
set "office=%ProgramFiles(x86)%\Microsoft Office\Office14"
|
||||
)
|
||||
if exist "!office!\ospp.vbs" (
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office 2010 C2R Status ***
|
||||
echo %line2%
|
||||
cscript //nologo "!office!\ospp.vbs" /dstatus
|
||||
)
|
||||
|
||||
:casVend
|
||||
echo.
|
||||
echo Press any key to exit.
|
||||
pause >nul
|
||||
exit /b
|
||||
:: Leave empty line below
|
@ -1,565 +0,0 @@
|
||||
<!-- : Begin batch script
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
:: Check-Activation-Status-wmi.cmd
|
||||
:: Written by @abbodi1406
|
||||
:: forums.mydigitallife.net/posts/838808
|
||||
|
||||
|
||||
|
||||
|
||||
set WMI_VBS=0
|
||||
@cls
|
||||
set _args=
|
||||
set _args=%*
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-wow" set _rel1=1
|
||||
if /i "%%A"=="-arm" set _rel2=1
|
||||
)
|
||||
set "_cmdf=%~f0"
|
||||
if exist "%SystemRoot%\Sysnative\cmd.exe" if not defined _rel1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" -wow"
|
||||
exit /b
|
||||
)
|
||||
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 if not defined _rel2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" -arm"
|
||||
exit /b
|
||||
)
|
||||
color 07
|
||||
title Check Activation Status [wmi]
|
||||
set wspp=SoftwareLicensingProduct
|
||||
set wsps=SoftwareLicensingService
|
||||
set ospp=OfficeSoftwareProtectionProduct
|
||||
set osps=OfficeSoftwareProtectionService
|
||||
set winApp=55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
set o14App=59a52881-a989-479d-af46-f275c6370663
|
||||
set o15App=0ff1ce15-a989-479d-af46-f275c6370663
|
||||
for %%# in (spp_get,ospp_get,cW1nd0ws,sppw,c0ff1ce15,sppo,osppsvc,ospp14,ospp15) do set "%%#="
|
||||
for /f "tokens=6 delims=[]. " %%# in ('ver') do set winbuild=%%#
|
||||
set "spp_get=Description, DiscoveredKeyManagementServiceMachineName, DiscoveredKeyManagementServiceMachinePort, EvaluationEndDate, GracePeriodRemaining, ID, KeyManagementServiceMachine, KeyManagementServicePort, KeyManagementServiceProductKeyID, LicenseStatus, LicenseStatusReason, Name, PartialProductKey, ProductKeyID, VLActivationInterval, VLRenewalInterval"
|
||||
set "ospp_get=%spp_get%"
|
||||
if %winbuild% GEQ 9200 set "spp_get=%spp_get%, KeyManagementServiceLookupDomain, VLActivationTypeEnabled"
|
||||
if %winbuild% GEQ 9600 set "spp_get=%spp_get%, DiscoveredKeyManagementServiceMachineIpAddress, ProductKeyChannel"
|
||||
set "_work=%~dp0"
|
||||
set "_batf=%~f0"
|
||||
set "_batp=%_batf:'=''%"
|
||||
set "_Local=%LocalAppData%"
|
||||
set _Identity=0
|
||||
setlocal EnableDelayedExpansion
|
||||
dir /b /s /a:-d "!_Local!\Microsoft\Office\Licenses\*1*" 1>nul 2>nul && set _Identity=1
|
||||
dir /b /s /a:-d "!ProgramData!\Microsoft\Office\Licenses\*1*" 1>nul 2>nul && set _Identity=1
|
||||
pushd "!_work!"
|
||||
setlocal DisableDelayedExpansion
|
||||
if %winbuild% LSS 9200 if not exist "%SystemRoot%\servicing\Packages\Microsoft-Windows-PowerShell-WTR-Package~*.mum" set _Identity=0
|
||||
|
||||
set "SysPath=%SystemRoot%\System32"
|
||||
set "Path=%SystemRoot%\System32;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||
set "SysPath=%SystemRoot%\Sysnative"
|
||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||
)
|
||||
|
||||
:: Check LF line ending
|
||||
|
||||
pushd "%~dp0"
|
||||
>nul findstr /v "$" "%~nx0" && (
|
||||
echo:
|
||||
echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
ping 127.0.0.1 -n 6 >nul
|
||||
popd
|
||||
exit /b
|
||||
)
|
||||
popd
|
||||
|
||||
set ohook=
|
||||
for %%# in (15 16) do (
|
||||
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
|
||||
if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set ohook=1
|
||||
)
|
||||
)
|
||||
|
||||
for %%# in (System SystemX86) do (
|
||||
for %%G in ("Office 15" "Office") do (
|
||||
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
|
||||
if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" set ohook=1
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set _cwmi=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
wmic path Win32_ComputerSystem get CreationClassName /value 2>nul | find /i "ComputerSystem" 1>nul && set _cwmi=1
|
||||
)
|
||||
|
||||
if %_cwmi% EQU 0 (
|
||||
echo:
|
||||
echo Error: WMI is not responding in the system.
|
||||
echo:
|
||||
echo In MAS, Goto Troubleshoot and run Fix WMI option.
|
||||
echo:
|
||||
echo Press any key to exit...
|
||||
pause >nul
|
||||
exit /b
|
||||
)
|
||||
|
||||
set "line2=************************************************************"
|
||||
set "line3=____________________________________________________________"
|
||||
set "_psc=powershell"
|
||||
|
||||
set _prsh=1
|
||||
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _prsh=0
|
||||
set "_csg=cscript.exe //NoLogo //Job:WmiMulti "%~nx0?.wsf""
|
||||
set "_csq=cscript.exe //NoLogo //Job:WmiQuery "%~nx0?.wsf""
|
||||
set "_csx=cscript.exe //NoLogo //Job:XPDT "%~nx0?.wsf""
|
||||
if %_cwmi% EQU 0 set WMI_VBS=1
|
||||
if %WMI_VBS% EQU 0 (
|
||||
set "_zz1=wmic path"
|
||||
set "_zz2=where"
|
||||
set "_zz3=get"
|
||||
set "_zz4=/value"
|
||||
set "_zz5=("
|
||||
set "_zz6=)"
|
||||
set "_zz7="wmic path"
|
||||
set "_zz8=/value""
|
||||
) else (
|
||||
set "_zz1=%_csq%"
|
||||
set "_zz2="
|
||||
set "_zz3="
|
||||
set "_zz4="
|
||||
set "_zz5=""
|
||||
set "_zz6=""
|
||||
set "_zz7=%_csq%"
|
||||
set "_zz8="
|
||||
)
|
||||
set _WSH=0
|
||||
set OsppHook=1
|
||||
sc query osppsvc >nul 2>&1
|
||||
if %errorlevel% EQU 1060 set OsppHook=0
|
||||
|
||||
net start sppsvc /y >nul 2>&1
|
||||
call :casWpkey %wspp% %winApp% cW1nd0ws sppw
|
||||
if %winbuild% GEQ 9200 call :casWpkey %wspp% %o15App% c0ff1ce15 sppo
|
||||
if %OsppHook% NEQ 0 (
|
||||
net start osppsvc /y >nul 2>&1
|
||||
call :casWpkey %ospp% %o14App% osppsvc ospp14
|
||||
if %winbuild% LSS 9200 call :casWpkey %ospp% %o15App% osppsvc ospp15
|
||||
)
|
||||
|
||||
echo %line2%
|
||||
echo *** Windows Status ***
|
||||
echo %line2%
|
||||
if not defined cW1nd0ws (
|
||||
echo.
|
||||
echo Error: product key not found.
|
||||
goto :casWcon
|
||||
)
|
||||
set winID=1
|
||||
set "_qr=%_zz7% %wspp% %_zz2% %_zz5%ApplicationID='%winApp%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
|
||||
for /f "tokens=2 delims==" %%# in ('%_qr%') do (
|
||||
set "chkID=%%#"
|
||||
call :casWdet "%wspp%" "%wsps%" "%spp_get%"
|
||||
call :casWout
|
||||
echo %line3%
|
||||
echo.
|
||||
)
|
||||
|
||||
if defined ohook (
|
||||
echo.
|
||||
echo.
|
||||
echo %line2%
|
||||
echo *** Office Ohook Activation Status ***
|
||||
echo %line2%
|
||||
echo.
|
||||
powershell "write-host -back 'Black' -fore 'Yellow' 'Ohook for permanent Office activation is installed.'; write-host -back 'Black' -fore 'Yellow' 'You can ignore below Office activation status.'"
|
||||
echo.
|
||||
)
|
||||
|
||||
:casWcon
|
||||
set winID=0
|
||||
set verbose=1
|
||||
if not defined c0ff1ce15 (
|
||||
if defined osppsvc goto :casWospp
|
||||
goto :casWend
|
||||
)
|
||||
echo %line2%
|
||||
echo *** Office Status ***
|
||||
echo %line2%
|
||||
set "_qr=%_zz7% %wspp% %_zz2% %_zz5%ApplicationID='%o15App%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
|
||||
for /f "tokens=2 delims==" %%# in ('%_qr%') do (
|
||||
set "chkID=%%#"
|
||||
call :casWdet "%wspp%" "%wsps%" "%spp_get%"
|
||||
call :casWout
|
||||
echo %line3%
|
||||
echo.
|
||||
)
|
||||
set verbose=0
|
||||
if defined osppsvc goto :casWospp
|
||||
goto :casWend
|
||||
|
||||
:casWospp
|
||||
if %verbose% EQU 1 (
|
||||
echo %line2%
|
||||
echo *** Office Status ***
|
||||
echo %line2%
|
||||
)
|
||||
set "_qr=%_zz7% %ospp% %_zz2% %_zz5%ApplicationID='%o15App%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
|
||||
if defined ospp15 for /f "tokens=2 delims==" %%# in ('%_qr%') do (
|
||||
set "chkID=%%#"
|
||||
call :casWdet "%ospp%" "%osps%" "%ospp_get%"
|
||||
call :casWout
|
||||
echo %line3%
|
||||
echo.
|
||||
)
|
||||
set "_qr=%_zz7% %ospp% %_zz2% %_zz5%ApplicationID='%o14App%' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz8%"
|
||||
if defined ospp14 for /f "tokens=2 delims==" %%# in ('%_qr%') do (
|
||||
set "chkID=%%#"
|
||||
call :casWdet "%ospp%" "%osps%" "%ospp_get%"
|
||||
call :casWout
|
||||
echo %line3%
|
||||
echo.
|
||||
)
|
||||
goto :casWend
|
||||
|
||||
:casWpkey
|
||||
set "_qr=%_zz1% %1 %_zz2% %_zz5%ApplicationID='%2' and PartialProductKey is not null%_zz6% %_zz3% ID %_zz4%"
|
||||
%_qr% 2>nul | findstr /i ID 1>nul && (set %3=1&set %4=1)
|
||||
exit /b
|
||||
|
||||
:casWdet
|
||||
for %%# in (%~3) do set "%%#="
|
||||
if /i %~1==%ospp% for %%# in (DiscoveredKeyManagementServiceMachineIpAddress, KeyManagementServiceLookupDomain, ProductKeyChannel, VLActivationTypeEnabled) do set "%%#="
|
||||
set "cKmsClient="
|
||||
set "cTblClient="
|
||||
set "cAvmClient="
|
||||
set "ExpireMsg="
|
||||
set "_xpr="
|
||||
set "_qr="wmic path %~1 where ID='%chkID%' get %~3 /value" ^| findstr ^="
|
||||
if %WMI_VBS% NEQ 0 set "_qr=%_csg% %~1 "ID='%chkID%'" "%~3""
|
||||
for /f "tokens=* delims=" %%# in ('%_qr%') do set "%%#"
|
||||
|
||||
set /a _gpr=(GracePeriodRemaining+1440-1)/1440
|
||||
echo %Description%| findstr /i VOLUME_KMSCLIENT 1>nul && (set cKmsClient=1&set _mTag=Volume)
|
||||
echo %Description%| findstr /i TIMEBASED_ 1>nul && (set cTblClient=1&set _mTag=Timebased)
|
||||
echo %Description%| findstr /i VIRTUAL_MACHINE_ACTIVATION 1>nul && (set cAvmClient=1&set _mTag=Automatic VM)
|
||||
cmd /c exit /b %LicenseStatusReason%
|
||||
set "LicenseReason=%=ExitCode%"
|
||||
set "LicenseMsg=Time remaining: %GracePeriodRemaining% minute(s) (%_gpr% day(s))"
|
||||
if %_gpr% GEQ 1 if %_WSH% EQU 1 (
|
||||
for /f "tokens=* delims=" %%# in ('%_csx% %GracePeriodRemaining%') do set "_xpr=%%#"
|
||||
)
|
||||
if %_gpr% GEQ 1 if %_prsh% EQU 1 if not defined _xpr (
|
||||
for /f "tokens=* delims=" %%# in ('%_psc% "$([DateTime]::Now.addMinutes(%GracePeriodRemaining%)).ToString('yyyy-MM-dd HH:mm:ss')" 2^>nul') do set "_xpr=%%#"
|
||||
title Check Activation Status [wmi]
|
||||
)
|
||||
|
||||
if %LicenseStatus% EQU 0 (
|
||||
set "License=Unlicensed"
|
||||
set "LicenseMsg="
|
||||
)
|
||||
if %LicenseStatus% EQU 1 (
|
||||
set "License=Licensed"
|
||||
set "LicenseMsg="
|
||||
if %GracePeriodRemaining% EQU 0 (
|
||||
if %winID% EQU 1 (set "ExpireMsg=The machine is permanently activated.") else (set "ExpireMsg=The product is permanently activated.")
|
||||
) else (
|
||||
set "LicenseMsg=%_mTag% activation expiration: %GracePeriodRemaining% minute(s) (%_gpr% day(s))"
|
||||
if defined _xpr set "ExpireMsg=%_mTag% activation will expire %_xpr%"
|
||||
)
|
||||
)
|
||||
if %LicenseStatus% EQU 2 (
|
||||
set "License=Initial grace period"
|
||||
if defined _xpr set "ExpireMsg=Initial grace period ends %_xpr%"
|
||||
)
|
||||
if %LicenseStatus% EQU 3 (
|
||||
set "License=Additional grace period (KMS license expired or hardware out of tolerance)"
|
||||
if defined _xpr set "ExpireMsg=Additional grace period ends %_xpr%"
|
||||
)
|
||||
if %LicenseStatus% EQU 4 (
|
||||
set "License=Non-genuine grace period."
|
||||
if defined _xpr set "ExpireMsg=Non-genuine grace period ends %_xpr%"
|
||||
)
|
||||
if %LicenseStatus% EQU 6 (
|
||||
set "License=Extended grace period"
|
||||
if defined _xpr set "ExpireMsg=Extended grace period ends %_xpr%"
|
||||
)
|
||||
if %LicenseStatus% EQU 5 (
|
||||
set "License=Notification"
|
||||
if "%LicenseReason%"=="C004F200" (set "LicenseMsg=Notification Reason: 0xC004F200 (non-genuine)."
|
||||
) else if "%LicenseReason%"=="C004F009" (set "LicenseMsg=Notification Reason: 0xC004F009 (grace time expired)."
|
||||
) else (set "LicenseMsg=Notification Reason: 0x%LicenseReason%"
|
||||
)
|
||||
)
|
||||
if %LicenseStatus% GTR 6 (
|
||||
set "License=Unknown"
|
||||
set "LicenseMsg="
|
||||
)
|
||||
if not defined cKmsClient exit /b
|
||||
|
||||
if %KeyManagementServicePort%==0 set KeyManagementServicePort=1688
|
||||
set "KmsReg=Registered KMS machine name: %KeyManagementServiceMachine%:%KeyManagementServicePort%"
|
||||
if "%KeyManagementServiceMachine%"=="" set "KmsReg=Registered KMS machine name: KMS name not available"
|
||||
|
||||
if %DiscoveredKeyManagementServiceMachinePort%==0 set DiscoveredKeyManagementServiceMachinePort=1688
|
||||
set "KmsDns=KMS machine name from DNS: %DiscoveredKeyManagementServiceMachineName%:%DiscoveredKeyManagementServiceMachinePort%"
|
||||
if "%DiscoveredKeyManagementServiceMachineName%"=="" set "KmsDns=DNS auto-discovery: KMS name not available"
|
||||
|
||||
set "_qr="wmic path %~2 get ClientMachineID, KeyManagementServiceHostCaching /value" ^| findstr ^="
|
||||
if %WMI_VBS% NEQ 0 set "_qr=%_csg% %~2 "ClientMachineID, KeyManagementServiceHostCaching""
|
||||
for /f "tokens=* delims=" %%# in ('%_qr%') do set "%%#"
|
||||
if /i %KeyManagementServiceHostCaching%==True (set KeyManagementServiceHostCaching=Enabled) else (set KeyManagementServiceHostCaching=Disabled)
|
||||
|
||||
if %winbuild% LSS 9200 exit /b
|
||||
if /i %~1==%ospp% exit /b
|
||||
|
||||
if "%KeyManagementServiceLookupDomain%"=="" set "KeyManagementServiceLookupDomain="
|
||||
|
||||
if %VLActivationTypeEnabled% EQU 3 (
|
||||
set VLActivationType=Token
|
||||
) else if %VLActivationTypeEnabled% EQU 2 (
|
||||
set VLActivationType=KMS
|
||||
) else if %VLActivationTypeEnabled% EQU 1 (
|
||||
set VLActivationType=AD
|
||||
) else (
|
||||
set VLActivationType=All
|
||||
)
|
||||
|
||||
if %winbuild% LSS 9600 exit /b
|
||||
if "%DiscoveredKeyManagementServiceMachineIpAddress%"=="" set "DiscoveredKeyManagementServiceMachineIpAddress=not available"
|
||||
exit /b
|
||||
|
||||
:casWout
|
||||
echo.
|
||||
echo Name: %Name%
|
||||
echo Description: %Description%
|
||||
echo Activation ID: %ID%
|
||||
echo Extended PID: %ProductKeyID%
|
||||
if defined ProductKeyChannel echo Product Key Channel: %ProductKeyChannel%
|
||||
echo Partial Product Key: %PartialProductKey%
|
||||
echo License Status: %License%
|
||||
if defined LicenseMsg echo %LicenseMsg%
|
||||
if not %LicenseStatus%==0 if not %EvaluationEndDate:~0,8%==16010101 echo Evaluation End Date: %EvaluationEndDate:~0,4%-%EvaluationEndDate:~4,2%-%EvaluationEndDate:~6,2% %EvaluationEndDate:~8,2%:%EvaluationEndDate:~10,2% UTC
|
||||
if not defined cKmsClient (
|
||||
if defined ExpireMsg echo.&echo. %ExpireMsg%
|
||||
exit /b
|
||||
)
|
||||
if defined VLActivationTypeEnabled echo Configured Activation Type: %VLActivationType%
|
||||
echo.
|
||||
if not %LicenseStatus%==1 (
|
||||
echo Please activate the product in order to update KMS client information values.
|
||||
exit /b
|
||||
)
|
||||
echo Most recent activation information:
|
||||
echo Key Management Service client information
|
||||
echo. Client Machine ID (CMID): %ClientMachineID%
|
||||
echo. %KmsDns%
|
||||
echo. %KmsReg%
|
||||
if defined DiscoveredKeyManagementServiceMachineIpAddress echo. KMS machine IP address: %DiscoveredKeyManagementServiceMachineIpAddress%
|
||||
echo. KMS machine extended PID: %KeyManagementServiceProductKeyID%
|
||||
echo. Activation interval: %VLActivationInterval% minutes
|
||||
echo. Renewal interval: %VLRenewalInterval% minutes
|
||||
echo. KMS host caching: %KeyManagementServiceHostCaching%
|
||||
if defined KeyManagementServiceLookupDomain echo. KMS SRV record lookup domain: %KeyManagementServiceLookupDomain%
|
||||
if defined ExpireMsg echo.&echo. %ExpireMsg%
|
||||
exit /b
|
||||
|
||||
:casWend
|
||||
if %_Identity% EQU 1 if %_prsh% EQU 1 (
|
||||
echo %line2%
|
||||
echo *** Office vNext Status ***
|
||||
echo %line2%
|
||||
setlocal EnableDelayedExpansion
|
||||
%_psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':vNextDiag\:.*';iex ($f[1])"
|
||||
title Check Activation Status [wmi]
|
||||
echo %line3%
|
||||
echo.
|
||||
)
|
||||
echo.
|
||||
echo Press any key to exit.
|
||||
pause >nul
|
||||
exit /b
|
||||
|
||||
:vNextDiag:
|
||||
function PrintModePerPridFromRegistry
|
||||
{
|
||||
$vNextRegkey = "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LicensingNext"
|
||||
$vNextPrids = Get-Item -Path $vNextRegkey -ErrorAction Ignore | Select-Object -ExpandProperty 'property' | Where-Object -FilterScript {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}
|
||||
If ($vNextPrids -Eq $null)
|
||||
{
|
||||
Write-Host "No registry keys found."
|
||||
Return
|
||||
}
|
||||
$vNextPrids | ForEach `
|
||||
{
|
||||
$mode = (Get-ItemProperty -Path $vNextRegkey -Name $_).$_
|
||||
Switch ($mode)
|
||||
{
|
||||
2 { $mode = "vNext"; Break }
|
||||
3 { $mode = "Device"; Break }
|
||||
Default { $mode = "Legacy"; Break }
|
||||
}
|
||||
Write-Host $_ = $mode
|
||||
}
|
||||
}
|
||||
function PrintSharedComputerLicensing
|
||||
{
|
||||
$scaRegKey = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration"
|
||||
$scaValue = Get-ItemProperty -Path $scaRegKey -ErrorAction Ignore | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction Ignore
|
||||
$scaRegKey2 = "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing"
|
||||
$scaValue2 = Get-ItemProperty -Path $scaRegKey2 -ErrorAction Ignore | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction Ignore
|
||||
$scaPolicyKey = "HKLM:\SOFTWARE\Policies\Microsoft\Office\16.0\Common\Licensing"
|
||||
$scaPolicyValue = Get-ItemProperty -Path $scaPolicyKey -ErrorAction Ignore | Select-Object -ExpandProperty "SharedComputerLicensing" -ErrorAction Ignore
|
||||
If ($scaValue -Eq $null -And $scaValue2 -Eq $null -And $scaPolicyValue -Eq $null)
|
||||
{
|
||||
Write-Host "No registry keys found."
|
||||
Return
|
||||
}
|
||||
$scaModeValue = $scaValue -Or $scaValue2 -Or $scaPolicyValue
|
||||
If ($scaModeValue -Eq 0)
|
||||
{
|
||||
$scaMode = "Disabled"
|
||||
}
|
||||
If ($scaModeValue -Eq 1)
|
||||
{
|
||||
$scaMode = "Enabled"
|
||||
}
|
||||
Write-Host "SharedComputerLicensing" = $scaMode
|
||||
Write-Host
|
||||
$tokenFiles = $null
|
||||
$tokenPath = "${env:LOCALAPPDATA}\Microsoft\Office\16.0\Licensing"
|
||||
If (Test-Path $tokenPath)
|
||||
{
|
||||
$tokenFiles = Get-ChildItem -Path $tokenPath -Recurse -File -Filter "*authString*"
|
||||
}
|
||||
If ($tokenFiles.length -Eq 0)
|
||||
{
|
||||
Write-Host "No tokens found."
|
||||
Return
|
||||
}
|
||||
$tokenFiles | ForEach `
|
||||
{
|
||||
$tokenParts = (Get-Content -Encoding Unicode -Path $_.FullName).Split('_')
|
||||
$output = [PSCustomObject] `
|
||||
@{
|
||||
ACID = $tokenParts[0];
|
||||
User = $tokenParts[3]
|
||||
NotBefore = $tokenParts[4];
|
||||
NotAfter = $tokenParts[5];
|
||||
} | ConvertTo-Json
|
||||
Write-Host $output
|
||||
}
|
||||
}
|
||||
function PrintLicensesInformation
|
||||
{
|
||||
Param(
|
||||
[ValidateSet("NUL", "Device")]
|
||||
[String]$mode
|
||||
)
|
||||
If ($mode -Eq "NUL")
|
||||
{
|
||||
$licensePath = "${env:LOCALAPPDATA}\Microsoft\Office\Licenses"
|
||||
}
|
||||
ElseIf ($mode -Eq "Device")
|
||||
{
|
||||
$licensePath = "${env:PROGRAMDATA}\Microsoft\Office\Licenses"
|
||||
}
|
||||
$licenseFiles = $null
|
||||
If (Test-Path $licensePath)
|
||||
{
|
||||
$licenseFiles = Get-ChildItem -Path $licensePath -Recurse -File
|
||||
}
|
||||
If ($licenseFiles.length -Eq 0)
|
||||
{
|
||||
Write-Host "No licenses found."
|
||||
Return
|
||||
}
|
||||
$licenseFiles | ForEach `
|
||||
{
|
||||
$license = (Get-Content -Encoding Unicode $_.FullName | ConvertFrom-Json).License
|
||||
$decodedLicense = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($license)) | ConvertFrom-Json
|
||||
$licenseType = $decodedLicense.LicenseType
|
||||
If ($null -Ne $decodedLicense.ExpiresOn)
|
||||
{
|
||||
$expiry = [DateTime]::Parse($decodedLicense.ExpiresOn, $null, 48)
|
||||
}
|
||||
Else
|
||||
{
|
||||
$expiry = New-Object DateTime
|
||||
}
|
||||
$licenseState = $null
|
||||
If ((Get-Date) -Gt (Get-Date $decodedLicense.MetaData.NotAfter))
|
||||
{
|
||||
$licenseState = "RFM"
|
||||
}
|
||||
ElseIf ((Get-Date) -Lt (Get-Date $expiry))
|
||||
{
|
||||
$licenseState = "Licensed"
|
||||
}
|
||||
Else
|
||||
{
|
||||
$licenseState = "Grace"
|
||||
}
|
||||
if ($mode -Eq "NUL")
|
||||
{
|
||||
$output = [PSCustomObject] `
|
||||
@{
|
||||
Version = $_.Directory.Name
|
||||
Type = "User|${licenseType}";
|
||||
Product = $decodedLicense.ProductReleaseId;
|
||||
Acid = $decodedLicense.Acid;
|
||||
LicenseState = $licenseState;
|
||||
EntitlementStatus = $decodedLicense.Status;
|
||||
EntitlementExpiration = $decodedLicense.ExpiresOn;
|
||||
ReasonCode = $decodedLicense.ReasonCode;
|
||||
NotBefore = $decodedLicense.Metadata.NotBefore;
|
||||
NotAfter = $decodedLicense.Metadata.NotAfter;
|
||||
NextRenewal = $decodedLicense.Metadata.RenewAfter;
|
||||
TenantId = $decodedLicense.Metadata.TenantId;
|
||||
} | ConvertTo-Json
|
||||
}
|
||||
ElseIf ($mode -Eq "Device")
|
||||
{
|
||||
$output = [PSCustomObject] `
|
||||
@{
|
||||
Version = $_.Directory.Name
|
||||
Type = "Device|${licenseType}";
|
||||
Product = $decodedLicense.ProductReleaseId;
|
||||
Acid = $decodedLicense.Acid;
|
||||
DeviceId = $decodedLicense.Metadata.DeviceId;
|
||||
LicenseState = $licenseState;
|
||||
EntitlementStatus = $decodedLicense.Status;
|
||||
EntitlementExpiration = $decodedLicense.ExpiresOn;
|
||||
ReasonCode = $decodedLicense.ReasonCode;
|
||||
NotBefore = $decodedLicense.Metadata.NotBefore;
|
||||
NotAfter = $decodedLicense.Metadata.NotAfter;
|
||||
NextRenewal = $decodedLicense.Metadata.RenewAfter;
|
||||
TenantId = $decodedLicense.Metadata.TenantId;
|
||||
} | ConvertTo-Json
|
||||
}
|
||||
Write-Output $output
|
||||
}
|
||||
}
|
||||
Write-Host
|
||||
Write-Host "========== Mode per ProductReleaseId =========="
|
||||
Write-Host
|
||||
PrintModePerPridFromRegistry
|
||||
Write-Host
|
||||
Write-Host "========== Shared Computer Licensing =========="
|
||||
Write-Host
|
||||
PrintSharedComputerLicensing
|
||||
Write-Host
|
||||
Write-Host "========== vNext licenses =========="
|
||||
Write-Host
|
||||
PrintLicensesInformation -Mode "NUL"
|
||||
Write-Host
|
||||
Write-Host "========== Device licenses =========="
|
||||
Write-Host
|
||||
PrintLicensesInformation -Mode "Device"
|
||||
:vNextDiag:
|
||||
::===================================================
|
||||
:: Leave empty line below
|
1025
MAS/Separate-Files-Version/Check-Activation-Status.cmd
Normal file
1025
MAS/Separate-Files-Version/Check-Activation-Status.cmd
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=2.4
|
||||
@set masver=2.6
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
|
||||
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Email: windowsaddict@protonmail.com
|
||||
@ -153,7 +153,7 @@ goto done2
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix for the special characters limitation in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
@ -186,7 +186,7 @@ goto done2
|
||||
%nul1% fltmc || (
|
||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script requires admin privileges.
|
||||
echo This script needs admin rights.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto done2
|
||||
)
|
||||
@ -222,7 +222,7 @@ echo ________________________________________________
|
||||
echo You are running outdated version MAS %masver%
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
echo [1] Download Latest MAS
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :ex_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.4
|
||||
@set masver=2.6
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
|
||||
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Email: windowsaddict@protonmail.com
|
||||
@ -138,7 +138,7 @@ goto at_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix for the special characters limitation in path name
|
||||
:: Fix special characters limitation in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
@ -172,7 +172,7 @@ goto at_done
|
||||
%nul1% fltmc || (
|
||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
|
||||
%nceline%
|
||||
echo This script requires admin privileges.
|
||||
echo This script needs admin rights.
|
||||
echo To do so, right click on this script and select 'Run as administrator'.
|
||||
goto at_done
|
||||
)
|
||||
@ -208,7 +208,7 @@ echo ________________________________________________
|
||||
echo You are running outdated version MAS %masver%
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
echo [1] Download Latest MAS
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
||||
@ -323,7 +323,7 @@ if %errorlevel%==1 goto at_menu
|
||||
|
||||
cls
|
||||
mode 110, 30
|
||||
call :_stopservice TrustedInstaller
|
||||
%psc% Stop-Service TrustedInstaller -force %nul%
|
||||
|
||||
set _time=
|
||||
for /f %%a in ('%psc% "Get-Date -format HH_mm_ss"') do set _time=%%a
|
||||
@ -332,7 +332,7 @@ echo Applying the command,
|
||||
echo dism /english /online /cleanup-image /restorehealth
|
||||
dism /english /online /cleanup-image /restorehealth
|
||||
|
||||
call :_stopservice TrustedInstaller
|
||||
%psc% Stop-Service TrustedInstaller -force %nul%
|
||||
|
||||
if not exist "!desktop!\AT_Logs\" md "!desktop!\AT_Logs\" %nul%
|
||||
|
||||
@ -375,7 +375,7 @@ choice /C:09 /N /M "> [9] Continue [0] Go back : "
|
||||
if %errorlevel%==1 goto at_menu
|
||||
|
||||
cls
|
||||
call :_stopservice TrustedInstaller
|
||||
%psc% Stop-Service TrustedInstaller -force %nul%
|
||||
|
||||
set _time=
|
||||
for /f %%a in ('%psc% "Get-Date -format HH_mm_ss"') do set _time=%%a
|
||||
@ -384,7 +384,7 @@ echo Applying the command,
|
||||
echo sfc /scannow
|
||||
sfc /scannow
|
||||
|
||||
call :_stopservice TrustedInstaller
|
||||
%psc% Stop-Service TrustedInstaller -force %nul%
|
||||
|
||||
if not exist "!desktop!\AT_Logs\" md "!desktop!\AT_Logs\" %nul%
|
||||
|
||||
@ -455,7 +455,7 @@ goto :cleanvnext
|
||||
)
|
||||
|
||||
echo Stopping ClipSVC service...
|
||||
call :_stopservice ClipSVC
|
||||
%psc% Stop-Service ClipSVC -force %nul%
|
||||
timeout /t 2 %nul%
|
||||
|
||||
echo:
|
||||
@ -505,7 +505,7 @@ call :_color %Red% "[Failed]"
|
||||
echo [Successful]
|
||||
)
|
||||
|
||||
call :_stopservice ClipSVC
|
||||
%psc% Stop-Service ClipSVC -force %nul%
|
||||
|
||||
:: Rebuild ClipSVC folder to fix permission issues
|
||||
|
||||
@ -522,7 +522,7 @@ echo [Successful]
|
||||
|
||||
echo:
|
||||
echo Rebuilding Folder %ProgramData%\Microsoft\Windows\ClipSVC\
|
||||
net start ClipSVC /y %nul%
|
||||
%psc% Start-Service ClipSVC %nul%
|
||||
timeout /t 3 %nul%
|
||||
if not exist "%ProgramData%\Microsoft\Windows\ClipSVC\" timeout /t 5 %nul%
|
||||
if not exist "%ProgramData%\Microsoft\Windows\ClipSVC\" (
|
||||
@ -534,7 +534,7 @@ echo [Successful]
|
||||
|
||||
echo:
|
||||
echo Restarting [wlidsvc LicenseManager] services...
|
||||
for %%# in (wlidsvc LicenseManager) do (net stop %%# /y %nul% & net start %%# /y %nul%)
|
||||
for %%# in (wlidsvc LicenseManager) do (%psc% Restart-Service %%# %nul%)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@ -580,7 +580,7 @@ echo Not Found - !_Local!\Microsoft\Office\Licenses\
|
||||
|
||||
|
||||
echo:
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$userSIDs = Get-WmiObject -Class Win32_UserAccount | ForEach-Object {write-host $_.SID}" %nul6%') do (if defined _sid (set "_sid=!_sid! HKU\%%a") else (set "_sid=HKU\%%a"))
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object { Split-Path -Path $_.PSPath -Leaf }" %nul6%') do (if defined _sid (set "_sid=!_sid! HKU\%%a") else (set "_sid=HKU\%%a"))
|
||||
|
||||
set regfound=
|
||||
for %%# in (HKCU !_sid!) do (
|
||||
@ -619,19 +619,13 @@ call :_color %Red% "tokens.dat file not found."
|
||||
echo tokens.dat file: [%token%]
|
||||
)
|
||||
|
||||
if %winbuild% GEQ 14393 (
|
||||
set wpaerror=
|
||||
set /a count=0
|
||||
for /f %%a in ('reg query "HKLM\SYSTEM\WPA" %nul6%') do set /a count+=1
|
||||
for /L %%# in (1,1,!count!) do (
|
||||
reg query "HKLM\SYSTEM\WPA\8DEC0AF1-0341-4b93-85CD-72606C2DF94C-7P-%%#" /ve /t REG_BINARY %nul% || set wpaerror=1
|
||||
)
|
||||
|
||||
if defined wpaerror (
|
||||
echo:
|
||||
echo Checking WPA Registry Keys...
|
||||
call :_color %Red% "[Error Found] [Registry Count - !count!]"
|
||||
)
|
||||
set wpainfo=
|
||||
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1]);" %nul6%') do (set wpainfo=%%a)
|
||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||
call :_color %Red% "WPA Registry Error: %wpainfo%"
|
||||
) || (
|
||||
echo WPA Registry Count: %wpainfo%
|
||||
)
|
||||
|
||||
set tokenstore=
|
||||
@ -679,7 +673,7 @@ echo [No Error Found]
|
||||
|
||||
echo:
|
||||
echo Stopping sppsvc service...
|
||||
call :_stopservice sppsvc
|
||||
%psc% Stop-Service sppsvc -force %nul%
|
||||
|
||||
echo:
|
||||
call :scandat delete
|
||||
@ -736,7 +730,7 @@ echo tokens.dat file: [%token%]
|
||||
|
||||
echo:
|
||||
echo Stopping osppsvc service...
|
||||
call :_stopservice osppsvc
|
||||
%psc% Stop-Service osppsvc -force %nul%
|
||||
|
||||
echo:
|
||||
call :scandatospp delete
|
||||
@ -750,11 +744,11 @@ echo:
|
||||
|
||||
echo:
|
||||
echo Starting osppsvc service to generate tokens.dat
|
||||
call :_startservice osppsvc
|
||||
%psc% Start-Service osppsvc %nul%
|
||||
call :scandatospp check
|
||||
if not defined token (
|
||||
call :_stopservice osppsvc
|
||||
call :_startservice osppsvc
|
||||
%psc% Stop-Service osppsvc -force %nul%
|
||||
%psc% Start-Service osppsvc %nul%
|
||||
timeout /t 3 %nul%
|
||||
)
|
||||
|
||||
@ -801,18 +795,20 @@ for %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%
|
||||
set _68=HKLM\SOFTWARE\Microsoft\Office
|
||||
set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
|
||||
|
||||
%nul% reg query %_68%\14.0\Common\InstallRoot /v Path && (set "msi14_68=Office 14.0 MSI x86/x64" & set "msi14repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE14\Office Setup Controller\Setup.exe")
|
||||
%nul% reg query %_86%\14.0\Common\InstallRoot /v Path && (set "msi14_86=Office 14.0 MSI x86" & set "msi14repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\Setup.exe")
|
||||
%nul% reg query %_68%\15.0\Common\InstallRoot /v Path && (set "msi15_68=Office 15.0 MSI x86/x64" & set "msi15repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE15\Office Setup Controller\Setup.exe")
|
||||
%nul% reg query %_86%\15.0\Common\InstallRoot /v Path && (set "msi15_86=Office 15.0 MSI x86" & set "msi15repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe")
|
||||
%nul% reg query %_68%\16.0\Common\InstallRoot /v Path && (set "msi16_68=Office 16.0 MSI x86/x64" & set "msi16repair68=%systemdrive%\Program Files\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
|
||||
%nul% reg query %_86%\16.0\Common\InstallRoot /v Path && (set "msi16_86=Office 16.0 MSI x86" & set "msi16repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
|
||||
%nul% reg query %_68%\14.0\CVH /f Click2run /k && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
|
||||
%nul% reg query %_86%\14.0\CVH /f Click2run /k && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
|
||||
%nul% reg query %_68%\15.0\ClickToRun /v InstallPath && (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
|
||||
%nul% reg query %_86%\15.0\ClickToRun /v InstallPath && (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
|
||||
%nul% reg query %_68%\ClickToRun /v InstallPath && (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
|
||||
%nul% reg query %_86%\ClickToRun /v InstallPath && (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
|
||||
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
|
||||
reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & set "msi14repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\Office Setup Controller\Setup.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & set "msi14repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE14\Office Setup Controller\Setup.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & set "msi15repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & set "msi15repair68=%systemdrive%\Program Files\Common Files\microsoft shared\OFFICE15\Office Setup Controller\Setup.exe")
|
||||
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" & set "msi16repair86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.exe")
|
||||
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" & set "msi16repair68=%systemdrive%\Program Files\Common Files\Microsoft Shared\OFFICE16\Office Setup Controller\Setup.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" & 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")
|
||||
|
||||
set uwp16=
|
||||
if %winbuild% GEQ 10240 (
|
||||
@ -938,7 +934,7 @@ call :checkwmi
|
||||
:: Apply basic fix first and check
|
||||
|
||||
if defined error (
|
||||
call :_stopservice Winmgmt
|
||||
%psc% Stop-Service Winmgmt -force %nul%
|
||||
winmgmt /salvagerepository %nul%
|
||||
call :checkwmi
|
||||
)
|
||||
@ -976,9 +972,9 @@ goto :at_back
|
||||
|
||||
echo:
|
||||
echo Stopping Winmgmt service
|
||||
call :_stopservice Winmgmt
|
||||
call :_stopservice Winmgmt
|
||||
call :_stopservice Winmgmt
|
||||
%psc% Stop-Service Winmgmt -force %nul%
|
||||
%psc% Stop-Service Winmgmt -force %nul%
|
||||
%psc% Stop-Service Winmgmt -force %nul%
|
||||
sc query Winmgmt | find /i "STOPPED" %nul% && (
|
||||
echo [Successful]
|
||||
) || (
|
||||
@ -1042,7 +1038,7 @@ goto :at_back
|
||||
|
||||
:: https://eskonr.com/2012/01/how-to-fix-wmi-issues-automatically/
|
||||
|
||||
call :_stopservice Winmgmt
|
||||
%psc% Stop-Service Winmgmt -force %nul%
|
||||
cd /d %systemroot%\system32\wbem\
|
||||
regsvr32 /s %systemroot%\system32\scecli.dll
|
||||
regsvr32 /s %systemroot%\system32\userenv.dll
|
||||
@ -1128,21 +1124,41 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:_stopservice
|
||||
:: This code checks for invalid registry keys in HKLM\SYSTEM\WPA. This issue may appear even on healthy systems
|
||||
|
||||
for %%# in (%1) do (
|
||||
sc query %%# | find /i "STOPPED" %nul% || net stop %%# /y %nul%
|
||||
sc query %%# | find /i "STOPPED" %nul% || sc stop %%# %nul%
|
||||
)
|
||||
exit /b
|
||||
:wpatest:
|
||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey("SYSTEM\\WPA")
|
||||
$count = $wpaKey.SubKeyCount
|
||||
|
||||
:_startservice
|
||||
$osVersion = [System.Environment]::OSVersion.Version
|
||||
$minBuildNumber = 14393
|
||||
|
||||
for %%# in (%1) do (
|
||||
sc query %%# | find /i "RUNNING" %nul% || net start %%# /y %nul%
|
||||
sc query %%# | find /i "RUNNING" %nul% || sc start %%# %nul%
|
||||
)
|
||||
exit /b
|
||||
if ($osVersion.Build -ge $minBuildNumber) {
|
||||
$subkeyHashTable = @{}
|
||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||
$keyNumber = $subkeyName -replace '.*-', ''
|
||||
$subkeyHashTable[$keyNumber] = $true
|
||||
}
|
||||
for ($i=1; $i -le $count; $i++) {
|
||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||
Write-Host "Total Keys $count. Error Found- $i key does not exist"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
}
|
||||
}
|
||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||
$subkey = $wpaKey.OpenSubKey($_)
|
||||
$p = $subkey.GetValueNames()
|
||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
||||
$wpaKey.Close()
|
||||
exit
|
||||
}
|
||||
}
|
||||
$count
|
||||
$wpaKey.Close()
|
||||
:wpatest:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
|
68
README.md
68
README.md
@ -1,57 +1,61 @@
|
||||
<p align="center"><img src="https://raw.githubusercontent.com/massgravel/mas-docs/main/logo.png" alt="MAS Logo" height="128"></p>
|
||||
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
||||
|
||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||
|
||||
<p align="center">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>
|
||||
<hr>
|
||||
|
||||
### Note: HWID Activation is working again with a new method.
|
||||
<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>
|
||||
|
||||
<hr>
|
||||
|
||||
## Download / How to use it?
|
||||
|
||||
### Method 1 - PowerShell (Recommended)
|
||||
|
||||
- On Windows 8.1/10/11, right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
|
||||
- Copy-paste the below code and press enter\
|
||||
`irm https://massgrave.dev/get | iex`
|
||||
- You will see the activation options, and follow onscreen instructions.
|
||||
- Right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
|
||||
- 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)
|
||||
```
|
||||
irm https://massgrave.dev/get | iex
|
||||
```
|
||||
- You will see the activation options. Follow the on-screen instructions.
|
||||
- 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
|
||||
|
||||
- Download the file from [here](https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip)
|
||||
- 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.cmd`
|
||||
- You will see the activation options, and follow onscreen instructions.
|
||||
- Run the file named `MAS_AIO-CRC32_XXXXXXXX.cmd`
|
||||
- You will see the activation options, follow the on-screen instructions.
|
||||
- That's all.
|
||||
|
||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches.html)
|
||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches)
|
||||
|
||||
```
|
||||
Latest Version: 2.4
|
||||
Release date: 21-Oct-2023
|
||||
```
|
||||
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot.html)
|
||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media.html)
|
||||
### Homepage - https://massgrave.dev
|
||||
</br>
|
||||
|
||||
[![1.1]][1]
|
||||
[![1.2]][2]
|
||||
[![1.3]][3]
|
||||
[![1.4]][4]
|
||||
```
|
||||
Latest Version: 2.6
|
||||
Release date: 20-Apr-2024
|
||||
```
|
||||
|
||||
[1.1]: https://lookimg.com/images/2023/03/21/QTvjcD.png (Chat with us without signup)
|
||||
[1.2]: https://lookimg.com/images/2023/03/21/QTvLyd.png (Chat with us)
|
||||
[1.3]: https://lookimg.com/images/2023/03/21/QTvXBJ.png (Follow on twitter)
|
||||
[1.4]: https://lookimg.com/images/2023/05/17/Q0iZ2U.png (Reddit)
|
||||
|
||||
[1]: https://discord.gg/gjJEfq7ux8
|
||||
[2]: https://t.me/Microsoft_Activation_Scripts
|
||||
[3]: https://twitter.com/massgravel
|
||||
[4]: https://www.reddit.com/r/MAS_Activator
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
||||
|
||||
---
|
||||
|
||||
|
Reference in New Issue
Block a user