mirror of
				https://github.com/massgravel/Microsoft-Activation-Scripts.git
				synced 2025-11-04 09:03:25 +08:00 
			
		
		
		
	Use ComObject instead of Get-ScheduledTask for more reliability, improve info
This commit is contained in:
		
							parent
							
								
									4ea26906cd
								
							
						
					
					
						commit
						6022b6de10
					
				@ -2171,19 +2171,22 @@ call :dk_color %Gray% "Checking SkipRearm                      [Default 0 Value
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
					if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
				
			||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
					%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
				
			||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
 | 
					for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo !taskinfo! | find /i "Ready" %nul% || (
 | 
					echo !taskinfo! | find /i "Ready" %nul% || (
 | 
				
			||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
					reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
				
			||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
					reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
				
			||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
					if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
call :dk_color %Red% "Checking SvcRestartTask Status          [!taskinfo!, system might deactivate later]"
 | 
					call :dk_color %Gray% "Checking SvcRestartTask Status          [!taskinfo!. System might deactivate later.]"
 | 
				
			||||||
if not defined showfix (
 | 
					if not defined showfix (
 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
 | 
					echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
 | 
				
			||||||
 | 
					set fixes=%fixes% %mas%in-place_repair_upgrade
 | 
				
			||||||
 | 
					call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
 | 
				
			||||||
 | 
					) || (
 | 
				
			||||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
					call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
				
			||||||
set fixes=%fixes% %mas%troubleshoot
 | 
					)
 | 
				
			||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
 | 
					 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -1855,19 +1855,22 @@ call :dk_color %Gray% "Checking SkipRearm                      [Default 0 Value
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
					if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
				
			||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
					%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
				
			||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
 | 
					for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo !taskinfo! | find /i "Ready" %nul% || (
 | 
					echo !taskinfo! | find /i "Ready" %nul% || (
 | 
				
			||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
					reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
				
			||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
					reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
				
			||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
					if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
call :dk_color %Red% "Checking SvcRestartTask Status          [!taskinfo!, system might deactivate later]"
 | 
					call :dk_color %Gray% "Checking SvcRestartTask Status          [!taskinfo!. System might deactivate later.]"
 | 
				
			||||||
if not defined showfix (
 | 
					if not defined showfix (
 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
 | 
					echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
 | 
				
			||||||
 | 
					set fixes=%fixes% %mas%in-place_repair_upgrade
 | 
				
			||||||
 | 
					call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
 | 
				
			||||||
 | 
					) || (
 | 
				
			||||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
					call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
				
			||||||
set fixes=%fixes% %mas%troubleshoot
 | 
					)
 | 
				
			||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
 | 
					 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -1940,19 +1940,22 @@ call :dk_color %Gray% "Checking SkipRearm                      [Default 0 Value
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
					if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
				
			||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
					%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
				
			||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
 | 
					for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo !taskinfo! | find /i "Ready" %nul% || (
 | 
					echo !taskinfo! | find /i "Ready" %nul% || (
 | 
				
			||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
					reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
				
			||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
					reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
				
			||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
					if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
call :dk_color %Red% "Checking SvcRestartTask Status          [!taskinfo!, system might deactivate later]"
 | 
					call :dk_color %Gray% "Checking SvcRestartTask Status          [!taskinfo!. System might deactivate later.]"
 | 
				
			||||||
if not defined showfix (
 | 
					if not defined showfix (
 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
 | 
					echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
 | 
				
			||||||
 | 
					set fixes=%fixes% %mas%in-place_repair_upgrade
 | 
				
			||||||
 | 
					call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
 | 
				
			||||||
 | 
					) || (
 | 
				
			||||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
					call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
				
			||||||
set fixes=%fixes% %mas%troubleshoot
 | 
					)
 | 
				
			||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
 | 
					 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -2541,19 +2541,22 @@ call :dk_color %Gray% "Checking SkipRearm                      [Default 0 Value
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
					if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
				
			||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
					%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
				
			||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
 | 
					for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo !taskinfo! | find /i "Ready" %nul% || (
 | 
					echo !taskinfo! | find /i "Ready" %nul% || (
 | 
				
			||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
					reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
				
			||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
					reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
				
			||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
					if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
call :dk_color %Red% "Checking SvcRestartTask Status          [!taskinfo!, system might deactivate later]"
 | 
					call :dk_color %Gray% "Checking SvcRestartTask Status          [!taskinfo!. System might deactivate later.]"
 | 
				
			||||||
if not defined showfix (
 | 
					if not defined showfix (
 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
 | 
					echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
 | 
				
			||||||
 | 
					set fixes=%fixes% %mas%in-place_repair_upgrade
 | 
				
			||||||
 | 
					call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
 | 
				
			||||||
 | 
					) || (
 | 
				
			||||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
					call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
				
			||||||
set fixes=%fixes% %mas%troubleshoot
 | 
					)
 | 
				
			||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
 | 
					 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -3604,19 +3604,22 @@ call :dk_color %Gray% "Checking SkipRearm                      [Default 0 Value
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
					if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
				
			||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
					%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
				
			||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
 | 
					for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo !taskinfo! | find /i "Ready" %nul% || (
 | 
					echo !taskinfo! | find /i "Ready" %nul% || (
 | 
				
			||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
					reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
				
			||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
					reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
				
			||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
					if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
call :dk_color %Red% "Checking SvcRestartTask Status          [!taskinfo!, system might deactivate later]"
 | 
					call :dk_color %Gray% "Checking SvcRestartTask Status          [!taskinfo!. System might deactivate later.]"
 | 
				
			||||||
if not defined showfix (
 | 
					if not defined showfix (
 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
 | 
					echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
 | 
				
			||||||
 | 
					set fixes=%fixes% %mas%in-place_repair_upgrade
 | 
				
			||||||
 | 
					call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
 | 
				
			||||||
 | 
					) || (
 | 
				
			||||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
					call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
				
			||||||
set fixes=%fixes% %mas%troubleshoot
 | 
					)
 | 
				
			||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
 | 
					 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -3610,19 +3610,22 @@ call :dk_color %Gray% "Checking SkipRearm                      [Default 0 Value
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
					if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
 | 
				
			||||||
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
					%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
 | 
				
			||||||
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
 | 
					for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo !taskinfo! | find /i "Ready" %nul% || (
 | 
					echo !taskinfo! | find /i "Ready" %nul% || (
 | 
				
			||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
					reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
 | 
				
			||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
					reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
 | 
				
			||||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
					if "!taskinfo!"=="" set "taskinfo=Not Found"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
call :dk_color %Red% "Checking SvcRestartTask Status          [!taskinfo!, system might deactivate later]"
 | 
					call :dk_color %Gray% "Checking SvcRestartTask Status          [!taskinfo!. System might deactivate later.]"
 | 
				
			||||||
if not defined showfix (
 | 
					if not defined showfix (
 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
 | 
					echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
 | 
				
			||||||
 | 
					set fixes=%fixes% %mas%in-place_repair_upgrade
 | 
				
			||||||
 | 
					call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
 | 
				
			||||||
 | 
					) || (
 | 
				
			||||||
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
					call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
 | 
				
			||||||
set fixes=%fixes% %mas%troubleshoot
 | 
					)
 | 
				
			||||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
 | 
					 | 
				
			||||||
echo:
 | 
					echo:
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user