@echo off echo ========================================== echo Fixing Temp folder permissions automatically... echo ========================================== icacls %windir%\Temp /grant "Authenticated Users":(OI)(CI)F /T /C icacls %windir%\Temp /grant "%username%":(OI)(CI)F /T /C if %errorlevel%==0 ( echo Temp folder permissions successfully updated. ) else ( echo Failed to update Temp folder permissions. Please check manually. ) echo ========================================== echo Resetting Windows Installer Service... echo ========================================== :: Unregister and re-register Windows Installer (32-bit) echo Unregistering 32-bit Windows Installer... %windir%\system32\msiexec.exe /unregister echo Re-registering 32-bit Windows Installer... %windir%\system32\msiexec.exe /regserver :: Unregister and re-register Windows Installer (64-bit) echo Unregistering 64-bit Windows Installer... %windir%\syswow64\msiexec.exe /unregister echo Re-registering 64-bit Windows Installer... %windir%\syswow64\msiexec.exe /regserver :: Check and start Windows Installer service echo Checking Windows Installer service status... sc query MSIServer | find "RUNNING" >nul if %errorlevel%==0 ( echo Windows Installer service is already running. ) else ( echo Starting Windows Installer service... net start MSIServer ) echo ========================================== echo Running System File Checker (sfc /scannow)... echo This may take several minutes. echo ========================================== sfc /scannow echo ========================================== echo Running System Health Check... echo This may take several minutes. echo ========================================== DISM /Online /Cleanup-Image /CheckHealth echo ========================================== echo Please restart your PC if needed! All tasks completed. echo Script finshed at: %date% %time% echo ========================================== pause