|
1 |
| -@set masver=3.2 |
| 1 | +@set masver=3.3 |
2 | 2 | @echo off
|
3 | 3 |
|
4 | 4 |
|
@@ -100,6 +100,8 @@ set "nul="
|
100 | 100 |
|
101 | 101 | set "blank="
|
102 | 102 | set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
| 103 | +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" |
| 104 | +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" |
103 | 105 |
|
104 | 106 | :: Check if Null service is working, it's important for the batch script
|
105 | 107 |
|
@@ -247,12 +249,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[
|
247 | 249 |
|
248 | 250 | if /i not "%tstresult%"=="FullLanguage" (
|
249 | 251 | %eline%
|
250 |
| -echo: %tstresult% |
251 |
| -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" |
| 252 | +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) |
| 253 | +echo Test 1 - %tstresult% |
| 254 | +echo Test 2 - !tstresult2! |
| 255 | +echo: |
252 | 256 |
|
253 | 257 | REM check LanguageMode
|
254 | 258 |
|
255 |
| -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( |
| 259 | +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( |
256 | 260 | echo FullLanguage mode not found in PowerShell. Aborting...
|
257 | 261 | echo If you have applied restrictions on Powershell then undo those changes.
|
258 | 262 | echo:
|
@@ -282,7 +286,13 @@ goto dk_done
|
282 | 286 | REM check antivirus and other errors
|
283 | 287 |
|
284 | 288 | echo PowerShell is not working properly. Aborting...
|
285 |
| -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 }""" |
| 289 | + |
| 290 | +if /i "!tstresult2!"=="FullLanguage" ( |
| 291 | +echo: |
| 292 | +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. |
| 293 | +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" |
| 294 | +) |
| 295 | + |
286 | 296 | echo:
|
287 | 297 | set fixes=%fixes% %mas%troubleshoot
|
288 | 298 | call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
@@ -364,7 +374,7 @@ echo:
|
364 | 374 | call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
365 | 375 | choice /C:10 /N
|
366 | 376 | if !errorlevel!==2 rem
|
367 |
| -if !errorlevel!==1 (start %mas% & exit /b) |
| 377 | +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) |
368 | 378 | )
|
369 | 379 | )
|
370 | 380 | cls
|
@@ -529,7 +539,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]"
|
529 | 539 |
|
530 | 540 | if defined ohub (
|
531 | 541 | echo:
|
532 |
| -echo You only have the Office dashboard app installed, you need to install the full version of Office. |
| 542 | +echo You only have the Office Dashboard app installed. You need to install the full version of Office. |
533 | 543 | )
|
534 | 544 | echo:
|
535 | 545 | call :dk_color %Blue% "Download and install Office from the below URL and then try again."
|
@@ -671,12 +681,12 @@ call :oh_hookinstall
|
671 | 681 |
|
672 | 682 | ::========================================================================================================================================
|
673 | 683 |
|
674 |
| -:: Old version (16.0.9xxxx and below) of Office with subscription license key may show a banner to sign in to fix license issue. |
| 684 | +:: Old version of Office with subscription license key may show a banner to sign in to fix license issue. |
675 | 685 | :: Although script applies a Resiliency registry entry to fix that but it doesn't work on old office versions.
|
676 | 686 | :: Below code checks that condition and informs the user to update the Office.
|
677 | 687 |
|
678 | 688 | if defined _sublic (
|
679 |
| -if not exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( |
| 689 | +if not exist "%_oLPath%\Word2021VL_KMS_Client_AE*.xrm-ms" ( |
680 | 690 | call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Office, otherwise, it may show a licensing issue-related banner.]"
|
681 | 691 | )
|
682 | 692 | )
|
@@ -1356,7 +1366,7 @@ exit /b
|
1356 | 1366 | :oh_clearblock
|
1357 | 1367 |
|
1358 | 1368 | :: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing
|
1359 |
| -:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state |
| 1369 | +:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state |
1360 | 1370 |
|
1361 | 1371 | set _sidlist=
|
1362 | 1372 | for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
@@ -1452,12 +1462,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
|
1452 | 1462 | )
|
1453 | 1463 |
|
1454 | 1464 | :: Clear device-based-licensing
|
1455 |
| -:: https://learn.microsoft.com/deployoffice/device-based-licensing |
| 1465 | +:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing |
1456 | 1466 |
|
1457 | 1467 | for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
|
1458 | 1468 |
|
1459 | 1469 | :: Remove OEM registry key
|
1460 |
| -:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 |
| 1470 | +:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 |
1461 | 1471 |
|
1462 | 1472 | for %%# in (15 16) do (
|
1463 | 1473 | reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul%
|
@@ -1701,9 +1711,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE
|
1701 | 1711 |
|
1702 | 1712 | if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
|
1703 | 1713 | set len=0
|
1704 |
| -echo:!allapps!> %SystemRoot%\Temp\chklen |
1705 |
| -for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) |
1706 |
| -del %SystemRoot%\Temp\chklen %nul% |
| 1714 | +echo:!allapps!> "!_ttemp!\chklen" |
| 1715 | +for %%A in ("!_ttemp!\chklen") do (set len=%%~zA) |
| 1716 | +del "!_ttemp!\chklen" %nul% |
1707 | 1717 |
|
1708 | 1718 | if !len! GTR 6000 (
|
1709 | 1719 | %eline%
|
@@ -1832,7 +1842,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
|
1832 | 1842 | if not "%results%%pupfound%"=="" (
|
1833 | 1843 | if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
1834 | 1844 | if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
1835 |
| -if defined results call :dk_color %Red% "%results%" |
| 1845 | +if defined results (call :dk_color %Red% "%results%"&set showfix=1) |
1836 | 1846 | set fixes=%fixes% %mas%remove_mal%w%ware
|
1837 | 1847 | call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
1838 | 1848 | echo:
|
@@ -1971,7 +1981,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
1971 | 1981 | )
|
1972 | 1982 |
|
1973 | 1983 |
|
1974 |
| -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states |
| 1984 | +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states |
1975 | 1985 |
|
1976 | 1986 | for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
1977 | 1987 |
|
@@ -2242,7 +2252,7 @@ set "permerror=Error Found In SPP Registries"
|
2242 | 2252 | )
|
2243 | 2253 | )
|
2244 | 2254 |
|
2245 |
| -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application |
| 2255 | +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application |
2246 | 2256 |
|
2247 | 2257 | if not defined permerror (
|
2248 | 2258 | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
@@ -2368,7 +2378,7 @@ call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
2368 | 2378 | call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
2369 | 2379 | choice /C:10 /N
|
2370 | 2380 | if !errorlevel!==2 exit /b
|
2371 |
| -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) |
| 2381 | +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) |
2372 | 2382 | )
|
2373 | 2383 |
|
2374 | 2384 | if defined terminal (
|
|
0 commit comments