Compare commits
4 Commits
b80a502086
...
d384c5f2f7
Author | SHA1 | Date |
---|---|---|
WindowsAddict | d384c5f2f7 | |
WindowsAddict | 643d4f077f | |
WindowsAddict | db26b75b64 | |
WindowsAddict | 07ad5a208d |
|
@ -781,7 +781,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
set error=1
|
set error=1
|
||||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
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...]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2808,42 +2808,29 @@ set _sortIds=!_sortIds:PreInstallR_=Retail_!
|
||||||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||||
|
|
||||||
set _sidlist=
|
set _sidlist=
|
||||||
set failedload=
|
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))
|
||||||
|
|
||||||
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 ($_.PSChildName -match '^S-([^-\n]*-){5,}[^-\n]*$' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_ -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
|
||||||
|
|
||||||
:: Fallback method
|
|
||||||
if not defined _sidlist (
|
if not defined _sidlist (
|
||||||
set failedload=1
|
|
||||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined _sidlist (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
set /a counter=0
|
|
||||||
for %%# in (%_sidlist%) do set /a counter+=1
|
|
||||||
|
|
||||||
if %counter% GTR 10 (
|
|
||||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
|
||||||
)
|
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
|
||||||
:: Load the unloaded useraccounts registry
|
:: Load the unloaded useraccounts registry
|
||||||
|
|
||||||
set loadedsids=
|
set loadedsids=
|
||||||
|
set alrloadedsids=
|
||||||
|
|
||||||
for %%# in (%_sidlist%) do (
|
for %%# in (%_sidlist%) do (
|
||||||
reg query HKU\%%#\Software %nul% || (
|
reg query HKU\%%#\Software %nul% && (
|
||||||
|
call set "alrloadedsids=%%alrloadedsids%% %%#"
|
||||||
|
) || (
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||||
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
||||||
reg query HKU\%%#\Software %nul% && (
|
reg query HKU\%%#\Software %nul% && (
|
||||||
call set "loadedsids=%%loadedsids%% %%#"
|
call set "loadedsids=%%loadedsids%% %%#"
|
||||||
) || (
|
) || (
|
||||||
set failedload=1
|
reg unload HKU\%%# %nul%
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -2851,6 +2838,23 @@ set failedload=1
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
|
||||||
|
set "_sidlist=%loadedsids% %alrloadedsids%"
|
||||||
|
|
||||||
|
set /a counter=0
|
||||||
|
for %%# in (%_sidlist%) do set /a counter+=1
|
||||||
|
|
||||||
|
if %counter% EQU 0 (
|
||||||
|
set error=1
|
||||||
|
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
if %counter% GTR 10 (
|
||||||
|
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||||
|
)
|
||||||
|
|
||||||
|
::==========================
|
||||||
|
|
||||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||||
|
|
||||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||||
|
@ -2905,24 +2909,23 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
|
||||||
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
||||||
:: Resiliency registry entry can skip this check
|
:: Resiliency registry entry can skip this check
|
||||||
|
|
||||||
set faileddef=
|
set defname=DEFTEMP-%random%
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
||||||
|
|
||||||
if defined o16c2r if defined officeact (
|
if defined o16c2r if defined officeact (
|
||||||
if exist "%defdat%\NTUSER.DAT" (
|
if exist "%defdat%\NTUSER.DAT" (
|
||||||
reg load HKU\DEF_TEMP "%defdat%\NTUSER.DAT" %nul%
|
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
|
||||||
reg query HKU\DEF_TEMP %nul% || set faileddef=1
|
reg query HKU\%defname%\Software %nul% && (
|
||||||
reg add HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
reg add HKU\%defname%\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||||
reg unload HKU\DEF_TEMP %nul%
|
|
||||||
reg query HKU\DEF_TEMP %nul% && set faileddef=1
|
|
||||||
) else (
|
|
||||||
set faileddef=1
|
|
||||||
)
|
)
|
||||||
|
reg unload HKU\%defname% %nul%
|
||||||
|
)
|
||||||
|
|
||||||
for %%# in (%_sidlist%) do (
|
for %%# in (%_sidlist%) do (
|
||||||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||||
)
|
)
|
||||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
echo Adding Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||||
)
|
)
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
@ -2931,15 +2934,6 @@ echo Adding Reg Keys to Skip License Check [Successfully added to all %counter
|
||||||
|
|
||||||
for %%# in (%loadedsids%) do (
|
for %%# in (%loadedsids%) do (
|
||||||
reg unload HKU\%%# %nul%
|
reg unload HKU\%%# %nul%
|
||||||
reg query HKU\%%# %nul% && set failedload=1
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined failedload (
|
|
||||||
call :dk_color %Gray% "Loading Unloading Registries [Failed for some user accounts]"
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined faileddef (
|
|
||||||
call :dk_color %Gray% "Loading Unloading Registries [Failed for Default\NTUSER.DAT]"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
@ -3925,7 +3919,7 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
set error=1
|
set error=1
|
||||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
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...]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -544,7 +544,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
set error=1
|
set error=1
|
||||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
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...]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -667,7 +667,7 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
set error=1
|
set error=1
|
||||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
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...]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1106,42 +1106,29 @@ set _sortIds=!_sortIds:PreInstallR_=Retail_!
|
||||||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||||
|
|
||||||
set _sidlist=
|
set _sidlist=
|
||||||
set failedload=
|
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))
|
||||||
|
|
||||||
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 ($_.PSChildName -match '^S-([^-\n]*-){5,}[^-\n]*$' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_ -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
|
||||||
|
|
||||||
:: Fallback method
|
|
||||||
if not defined _sidlist (
|
if not defined _sidlist (
|
||||||
set failedload=1
|
|
||||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined _sidlist (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
set /a counter=0
|
|
||||||
for %%# in (%_sidlist%) do set /a counter+=1
|
|
||||||
|
|
||||||
if %counter% GTR 10 (
|
|
||||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
|
||||||
)
|
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
|
||||||
:: Load the unloaded useraccounts registry
|
:: Load the unloaded useraccounts registry
|
||||||
|
|
||||||
set loadedsids=
|
set loadedsids=
|
||||||
|
set alrloadedsids=
|
||||||
|
|
||||||
for %%# in (%_sidlist%) do (
|
for %%# in (%_sidlist%) do (
|
||||||
reg query HKU\%%#\Software %nul% || (
|
reg query HKU\%%#\Software %nul% && (
|
||||||
|
call set "alrloadedsids=%%alrloadedsids%% %%#"
|
||||||
|
) || (
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||||
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
||||||
reg query HKU\%%#\Software %nul% && (
|
reg query HKU\%%#\Software %nul% && (
|
||||||
call set "loadedsids=%%loadedsids%% %%#"
|
call set "loadedsids=%%loadedsids%% %%#"
|
||||||
) || (
|
) || (
|
||||||
set failedload=1
|
reg unload HKU\%%# %nul%
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1149,6 +1136,23 @@ set failedload=1
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
|
||||||
|
set "_sidlist=%loadedsids% %alrloadedsids%"
|
||||||
|
|
||||||
|
set /a counter=0
|
||||||
|
for %%# in (%_sidlist%) do set /a counter+=1
|
||||||
|
|
||||||
|
if %counter% EQU 0 (
|
||||||
|
set error=1
|
||||||
|
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
if %counter% GTR 10 (
|
||||||
|
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||||
|
)
|
||||||
|
|
||||||
|
::==========================
|
||||||
|
|
||||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||||
|
|
||||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||||
|
@ -1203,24 +1207,23 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
|
||||||
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
||||||
:: Resiliency registry entry can skip this check
|
:: Resiliency registry entry can skip this check
|
||||||
|
|
||||||
set faileddef=
|
set defname=DEFTEMP-%random%
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
||||||
|
|
||||||
if defined o16c2r if defined officeact (
|
if defined o16c2r if defined officeact (
|
||||||
if exist "%defdat%\NTUSER.DAT" (
|
if exist "%defdat%\NTUSER.DAT" (
|
||||||
reg load HKU\DEF_TEMP "%defdat%\NTUSER.DAT" %nul%
|
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
|
||||||
reg query HKU\DEF_TEMP %nul% || set faileddef=1
|
reg query HKU\%defname%\Software %nul% && (
|
||||||
reg add HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
reg add HKU\%defname%\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||||
reg unload HKU\DEF_TEMP %nul%
|
|
||||||
reg query HKU\DEF_TEMP %nul% && set faileddef=1
|
|
||||||
) else (
|
|
||||||
set faileddef=1
|
|
||||||
)
|
)
|
||||||
|
reg unload HKU\%defname% %nul%
|
||||||
|
)
|
||||||
|
|
||||||
for %%# in (%_sidlist%) do (
|
for %%# in (%_sidlist%) do (
|
||||||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||||
)
|
)
|
||||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
echo Adding Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||||
)
|
)
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
@ -1229,15 +1232,6 @@ echo Adding Reg Keys to Skip License Check [Successfully added to all %counter
|
||||||
|
|
||||||
for %%# in (%loadedsids%) do (
|
for %%# in (%loadedsids%) do (
|
||||||
reg unload HKU\%%# %nul%
|
reg unload HKU\%%# %nul%
|
||||||
reg query HKU\%%# %nul% && set failedload=1
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined failedload (
|
|
||||||
call :dk_color %Gray% "Loading Unloading Registries [Failed for some user accounts]"
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined faileddef (
|
|
||||||
call :dk_color %Gray% "Loading Unloading Registries [Failed for Default\NTUSER.DAT]"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
|
@ -1207,42 +1207,29 @@ exit /b
|
||||||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||||
|
|
||||||
set _sidlist=
|
set _sidlist=
|
||||||
set failedload=
|
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))
|
||||||
|
|
||||||
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 ($_.PSChildName -match '^S-([^-\n]*-){5,}[^-\n]*$' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_ -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
|
||||||
|
|
||||||
:: Fallback method
|
|
||||||
if not defined _sidlist (
|
if not defined _sidlist (
|
||||||
set failedload=1
|
|
||||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined _sidlist (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
set /a counter=0
|
|
||||||
for %%# in (%_sidlist%) do set /a counter+=1
|
|
||||||
|
|
||||||
if %counter% GTR 10 (
|
|
||||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
|
||||||
)
|
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
|
||||||
:: Load the unloaded useraccounts registry
|
:: Load the unloaded useraccounts registry
|
||||||
|
|
||||||
set loadedsids=
|
set loadedsids=
|
||||||
|
set alrloadedsids=
|
||||||
|
|
||||||
for %%# in (%_sidlist%) do (
|
for %%# in (%_sidlist%) do (
|
||||||
reg query HKU\%%#\Software %nul% || (
|
reg query HKU\%%#\Software %nul% && (
|
||||||
|
call set "alrloadedsids=%%alrloadedsids%% %%#"
|
||||||
|
) || (
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||||
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
||||||
reg query HKU\%%#\Software %nul% && (
|
reg query HKU\%%#\Software %nul% && (
|
||||||
call set "loadedsids=%%loadedsids%% %%#"
|
call set "loadedsids=%%loadedsids%% %%#"
|
||||||
) || (
|
) || (
|
||||||
set failedload=1
|
reg unload HKU\%%# %nul%
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1250,6 +1237,23 @@ set failedload=1
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
|
||||||
|
set "_sidlist=%loadedsids% %alrloadedsids%"
|
||||||
|
|
||||||
|
set /a counter=0
|
||||||
|
for %%# in (%_sidlist%) do set /a counter+=1
|
||||||
|
|
||||||
|
if %counter% EQU 0 (
|
||||||
|
set error=1
|
||||||
|
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
if %counter% GTR 10 (
|
||||||
|
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||||
|
)
|
||||||
|
|
||||||
|
::==========================
|
||||||
|
|
||||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||||
|
|
||||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||||
|
@ -1304,24 +1308,23 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
|
||||||
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
||||||
:: Resiliency registry entry can skip this check
|
:: Resiliency registry entry can skip this check
|
||||||
|
|
||||||
set faileddef=
|
set defname=DEFTEMP-%random%
|
||||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
||||||
|
|
||||||
if defined o16c2r if defined officeact (
|
if defined o16c2r if defined officeact (
|
||||||
if exist "%defdat%\NTUSER.DAT" (
|
if exist "%defdat%\NTUSER.DAT" (
|
||||||
reg load HKU\DEF_TEMP "%defdat%\NTUSER.DAT" %nul%
|
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
|
||||||
reg query HKU\DEF_TEMP %nul% || set faileddef=1
|
reg query HKU\%defname%\Software %nul% && (
|
||||||
reg add HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
reg add HKU\%defname%\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||||
reg unload HKU\DEF_TEMP %nul%
|
|
||||||
reg query HKU\DEF_TEMP %nul% && set faileddef=1
|
|
||||||
) else (
|
|
||||||
set faileddef=1
|
|
||||||
)
|
)
|
||||||
|
reg unload HKU\%defname% %nul%
|
||||||
|
)
|
||||||
|
|
||||||
for %%# in (%_sidlist%) do (
|
for %%# in (%_sidlist%) do (
|
||||||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||||
)
|
)
|
||||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
echo Adding Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||||
)
|
)
|
||||||
|
|
||||||
::==========================
|
::==========================
|
||||||
|
@ -1330,15 +1333,6 @@ echo Adding Reg Keys to Skip License Check [Successfully added to all %counter
|
||||||
|
|
||||||
for %%# in (%loadedsids%) do (
|
for %%# in (%loadedsids%) do (
|
||||||
reg unload HKU\%%# %nul%
|
reg unload HKU\%%# %nul%
|
||||||
reg query HKU\%%# %nul% && set failedload=1
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined failedload (
|
|
||||||
call :dk_color %Gray% "Loading Unloading Registries [Failed for some user accounts]"
|
|
||||||
)
|
|
||||||
|
|
||||||
if defined faileddef (
|
|
||||||
call :dk_color %Gray% "Loading Unloading Registries [Failed for Default\NTUSER.DAT]"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
|
@ -37,7 +37,7 @@ irm https://massgrave.dev/get | iex
|
||||||
|
|
||||||
### Method 2 - Traditional (Windows 7 and later)
|
### Method 2 - Traditional (Windows 7 and later)
|
||||||
|
|
||||||
1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) / [Azure DevOps](https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts)
|
1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) / [Azure DevOps](https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts) / [Self-hosted Git](https://git.activated.win/massgrave/Microsoft-Activation-Scripts)
|
||||||
2. Right-click on the downloaded zip file and extract
|
2. Right-click on the downloaded zip file and extract
|
||||||
3. In the extracted folder, find the folder named `All-In-One-Version`
|
3. In the extracted folder, find the folder named `All-In-One-Version`
|
||||||
4. Run the file named `MAS_AIO.cmd`
|
4. Run the file named `MAS_AIO.cmd`
|
||||||
|
|
Loading…
Reference in New Issue