-
Notifications
You must be signed in to change notification settings - Fork 0
/
1. general computer maintainance.bat
57 lines (45 loc) · 1.57 KB
/
1. general computer maintainance.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
:: Check if the script is running with administrative privileges
:: If not, it will re-run itself with administrative privileges
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Requesting administrative privileges...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit
)
:: Check internet connection
echo Checking internet connection...
curl -s --head http://www.google.com | find "200 OK" >nul
if errorlevel 1 (
echo No internet connection...
echo Opening Adjust date/time settings for manual adjustment...
control timedate.cpl
start ms-settings:dateandtime
timeout /t 5 >nul
) else (
:: Force time synchronization
:: Time synchronization can resolve issues with website certificate errors due to incorrect system time.
w32tm /resync
)
echo Running System File Checker...
sfc /scannow
echo.
echo Running DISM to restore health...
DISM /Online /Cleanup-Image /RestoreHealth
echo.
echo Checking drive status...
wmic diskdrive get status
echo.
echo Checking drive predictive failure...
wmic /namespace:\\root\wmi path MSStorageDriver_FailurePredictStatus
echo.
echo Running DirectX Diagnostic Tool, please select Display tab manually and look at the message under Notes to see GPU condition...
dxdiag
echo.
echo Scheduling Check Disk to run on the next restart...
echo Note: chkdsk will only check drive C, the boot drive containing the operating system.
chkdsk C: /f /r /x
echo.
echo Scheduling Windows Memory Diagnostics Tool to run on the next restart...
mdsched
pause