mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2024-11-23 02:35:36 +08:00
Compare commits
5 Commits
1dfd3f6626
...
1f50e4ba98
Author | SHA1 | Date | |
---|---|---|---|
|
1f50e4ba98 | ||
|
af7d204c96 | ||
|
0d26ba046e | ||
|
3fd1666926 | ||
|
bf814304c6 |
@ -777,7 +777,7 @@ exit /b
|
|||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else (
|
||||||
if not exist %psc% (echo %~3) else (%psc% write-host -back '%1' -fore '%2' '%3')
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ exit /b
|
|||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||||
) else (
|
) else (
|
||||||
if not exist %psc% (echo %~3%~6) else (%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6')
|
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
@ -646,6 +646,23 @@ echo:
|
|||||||
echo Stopping sppsvc service...
|
echo Stopping sppsvc service...
|
||||||
%psc% Stop-Service sppsvc -force %nul%
|
%psc% Stop-Service sppsvc -force %nul%
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (
|
||||||
|
REM Fix issues caused by Update KB971033 in Windows 7
|
||||||
|
REM https://support.microsoft.com/help/4487266
|
||||||
|
echo:
|
||||||
|
echo Checking Update KB971033...
|
||||||
|
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
|
||||||
|
if !errorlevel!==3 (
|
||||||
|
echo Found, uninstalling it...
|
||||||
|
wusa /uninstall /quiet /norestart /kb:971033
|
||||||
|
) else (
|
||||||
|
echo [Not Found]
|
||||||
|
)
|
||||||
|
%psc% Stop-Service sppuinotify -force %nul%
|
||||||
|
sc config sppuinotify start= disabled
|
||||||
|
del /f /q %SysPath%\7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-8115-601632D005A0 /ah
|
||||||
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
call :scandat delete
|
call :scandat delete
|
||||||
call :scandat check
|
call :scandat check
|
||||||
@ -675,6 +692,10 @@ call :dk_color %Red% "Failed to rebuilt tokens.dat file."
|
|||||||
echo tokens.dat file was rebuilt successfully.
|
echo tokens.dat file was rebuilt successfully.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (
|
||||||
|
sc config sppuinotify start= demand
|
||||||
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Rebuild OSPP Tokens
|
:: Rebuild OSPP Tokens
|
||||||
@ -744,15 +765,6 @@ 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
|
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%"=="ARM64" (
|
|
||||||
echo:
|
|
||||||
echo ARM64 Windows Found.
|
|
||||||
echo You need to use repair option in Windows settings for Office.
|
|
||||||
echo:
|
|
||||||
start ms-settings:appsfeatures
|
|
||||||
goto :repairend
|
|
||||||
)
|
|
||||||
|
|
||||||
if /i "%arch%"=="x86" (
|
if /i "%arch%"=="x86" (
|
||||||
set arch=X86
|
set arch=X86
|
||||||
) else (
|
) else (
|
||||||
@ -769,12 +781,12 @@ set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
|
|||||||
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
|
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
|
||||||
reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
|
reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & 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 %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_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 %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_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 %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_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 %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15)
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_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 %_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" & 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 %_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 %_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 %_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")
|
||||||
@ -823,7 +835,7 @@ echo:
|
|||||||
|
|
||||||
if %counter% EQU 0 (
|
if %counter% EQU 0 (
|
||||||
echo:
|
echo:
|
||||||
echo Installed Office is not found.
|
echo Office ^(2010 and later^) is not installed.
|
||||||
goto :repairend
|
goto :repairend
|
||||||
echo:
|
echo:
|
||||||
) else (
|
) else (
|
||||||
@ -880,6 +892,15 @@ echo:
|
|||||||
call :dk_color %Green% "Finished"
|
call :dk_color %Green% "Finished"
|
||||||
goto :at_back
|
goto :at_back
|
||||||
|
|
||||||
|
:getrepairsetup
|
||||||
|
|
||||||
|
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
|
||||||
|
set "_common68=%systemdrive%\Program Files\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
|
||||||
|
|
||||||
|
if exist "%_common86%" set "%1=%_common86%"
|
||||||
|
if exist "%_common68%" set "%1=%_common68%"
|
||||||
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:fixwmi
|
:fixwmi
|
||||||
@ -962,8 +983,8 @@ exit
|
|||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Deleting WMI repository
|
echo Deleting WMI repository
|
||||||
rmdir /s /q "%windir%\System32\wbem\repository\" %nul%
|
rmdir /s /q "%SysPath%\wbem\repository\" %nul%
|
||||||
if exist "%windir%\System32\wbem\repository\" (
|
if exist "%SysPath%\wbem\repository\" (
|
||||||
call :dk_color %Red% "[Failed]"
|
call :dk_color %Red% "[Failed]"
|
||||||
) else (
|
) else (
|
||||||
echo [Successful]
|
echo [Successful]
|
||||||
@ -1008,9 +1029,9 @@ goto :at_back
|
|||||||
:: https://eskonr.com/2012/01/how-to-fix-wmi-issues-automatically/
|
:: https://eskonr.com/2012/01/how-to-fix-wmi-issues-automatically/
|
||||||
|
|
||||||
%psc% Stop-Service Winmgmt -force %nul%
|
%psc% Stop-Service Winmgmt -force %nul%
|
||||||
cd /d %systemroot%\system32\wbem\
|
cd /d %SysPath%\wbem\
|
||||||
regsvr32 /s %systemroot%\system32\scecli.dll
|
regsvr32 /s %SysPath%\scecli.dll
|
||||||
regsvr32 /s %systemroot%\system32\userenv.dll
|
regsvr32 /s %SysPath%\userenv.dll
|
||||||
mofcomp cimwin32.mof
|
mofcomp cimwin32.mof
|
||||||
mofcomp cimwin32.mfl
|
mofcomp cimwin32.mfl
|
||||||
mofcomp rsop.mof
|
mofcomp rsop.mof
|
||||||
@ -1256,9 +1277,9 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
set token=
|
set token=
|
||||||
for %%# in (
|
for %%# in (
|
||||||
%Systemdrive%\Windows\System32\spp\store_test\2.0\
|
%SysPath%\spp\store_test\2.0\
|
||||||
%Systemdrive%\Windows\System32\spp\store\
|
%SysPath%\spp\store\
|
||||||
%Systemdrive%\Windows\System32\spp\store\2.0\
|
%SysPath%\spp\store\2.0\
|
||||||
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
|
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
|
||||||
) do (
|
) do (
|
||||||
|
|
||||||
@ -1360,7 +1381,7 @@ exit /b
|
|||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else (
|
||||||
if not exist %psc% (echo %~3) else (%psc% write-host -back '%1' -fore '%2' '%3')
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@ -1369,7 +1390,7 @@ exit /b
|
|||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||||
) else (
|
) else (
|
||||||
if not exist %psc% (echo %~3%~6) else (%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6')
|
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user