From bf814304c62cbeba6e18ddf83b023363f3857dce Mon Sep 17 00:00:00 2001
From: WindowsAddict <windowsaddict@protonmail.com>
Date: Mon, 19 Aug 2024 18:40:07 +0530
Subject: [PATCH] Add fix for issues caused by update KB971033 in Windows 7

---
 MAS/Separate-Files-Version/Troubleshoot.cmd | 22 +++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd
index 40e3c3a..74ceb0e 100644
--- a/MAS/Separate-Files-Version/Troubleshoot.cmd
+++ b/MAS/Separate-Files-Version/Troubleshoot.cmd
@@ -646,6 +646,23 @@ echo:
 echo Stopping sppsvc service...
 %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:
 call :scandat delete
 call :scandat check
@@ -675,6 +692,10 @@ call :dk_color %Red% "Failed to rebuilt tokens.dat file."
 echo tokens.dat file was rebuilt successfully.
 )
 
+if %winbuild% LSS 9200 (
+sc config sppuinotify start= demand
+)
+
 ::========================================================================================================================================
 
 ::  Rebuild OSPP Tokens
@@ -1373,6 +1394,7 @@ if not exist %psc% (echo %~3%~6) else (%psc% write-host -back '%1' -fore '%2' '%
 )
 exit /b
 
+
 ::========================================================================================================================================
 
 ::  Set variables