-
Notifications
You must be signed in to change notification settings - Fork 0
/
reduce_disk_usage.cmd
64 lines (54 loc) · 4.22 KB
/
reduce_disk_usage.cmd
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
58
59
60
61
62
63
64
REM i/o reducing script for terminal servers
REM aims to srsly reduce the amount of i/o stupid programs use
REM without breaking them; do this by replacing folder with a file
REM stupid programs just silently continue working without all that disk i/o
REM make sure this starts up in user session - place in
REM C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
@ECHO OFF
SET logfile=%temp%\reduce_disk_usage.log
echo "Running reduce_disk_usage script for %USERNAME% at %DATE% %TIME%" > %logfile% 2>&1
REM try to install these registry entries to disable I/O-hogging logging
reg add HKCU\Policies\Microsoft\office\16.0\Outlook\Logging /v DisableDefaultLogging /t REG_DWORD /d 1 /f
reg add HKCU\Policies\Microsoft\office\16.0\Excel\Logging /v DisableDefaultLogging /t REG_DWORD /d 1 /f
reg add HKCU\Policies\Microsoft\office\16.0\Word\Logging /v DisableDefaultLogging /t REG_DWORD /d 1 /f
reg add HKCU\Policies\Microsoft\office\16.0\PowerPoint\Logging /v DisableDefaultLogging /t REG_DWORD /d 1 /f
reg add HKCU\Policies\Microsoft\office\16.0\Publisher\Logging /v DisableDefaultLogging /t REG_DWORD /d 1 /f
reg add HKCU\Policies\Microsoft\office\16.0\Access\Logging /v DisableDefaultLogging /t REG_DWORD /d 1 /f
REM disable office telemetry because it uses too much I/O also
reg add HKCU\Software\Policies\Microsoft\Office\16.0\Common /v QMEnable /t REG_DWORD /d 0 /f
reg add HKCU\Software\Policies\Microsoft\Office\16.0\Common /v SendCustomerData /t REG_DWORD /d 0 /f
reg add HKCU\Software\Policies\Microsoft\Office\16.0\osm /v EnableLogging /t REG_DWORD /d 0 /f
reg add HKCU\Software\Policies\Microsoft\Office\16.0\osm /v EnableFileObfuscation /t REG_DWORD /d 1 /f
reg add HKCU\Software\Policies\Microsoft\Office\16.0\osm /v EnableUpload /t REG_DWORD /d 0 /f
reg add HKCU\Software\Policies\Microsoft\Office\Common\ClientTelemetry /v DisableTelemetry /t REG_DWORD /d 1 /f
reg add HKCU\Software\Policies\Microsoft\Office\Common\ClientTelemetry /v SendTelemetry /t REG_DWORD /d 3 /f
REM office diagnostics are i/o intensive, try to do this first
rd /s /q "%Temp%\Outlook Logging" >> %logfile% 2>&1
REM alternate approach - disallow any access
mkdir "%Temp%\Outlook Logging" >> %logfile% 2>&1
echo y|cacls "%Temp%\Outlook Logging" /d %USERNAME% >> %logfile% 2>&1
REM mklink /j "%Temp%\Outlook Logging" null >> %logfile% 2>&1
rd /s /q %Temp%\Diagnostics >> %logfile% 2>&1
mkdir %Temp%\Diagnostics >> %logfile% 2>&1
echo y|cacls %Temp%\Diagnostics /d %USERNAME% >> %logfile% 2>&1
REM mklink /j %Temp%\Diagnostics null >> %logfile% 2>&1
REM service workers are the worst for i/o
REM mkdir in case cleanup script removed it
mkdir "%AppData%\Microsoft\Teams\Service Worker" >> %logfile% 2>&1
rd /s /q "%AppData%\Microsoft\Teams\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%AppData%\Microsoft\Teams\Service Worker\CacheStorage"
attrib +r "%AppData%\Microsoft\Teams\Service Worker\CacheStorage" >> %logfile% 2>&1
rd /s /q "%LocalAppData%\Google\Chrome\User Data\Default\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%LocalAppData%\Google\Chrome\User Data\Default\Service Worker\CacheStorage"
rd /s /q "%LocalAppData%\Google\Chrome\User Data\Profile 1\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%LocalAppData%\Google\Chrome\User Data\Profile 1\Service Worker\CacheStorage"
rd /s /q "%LocalAppData%\Google\Chrome\User Data\Profile 2\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%LocalAppData%\Google\Chrome\User Data\Profile 2\Service Worker\CacheStorage"
rd /s /q "%LocalAppData%\Google\Chrome\User Data\Guest Profile\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%LocalAppData%\Google\Chrome\User Data\Guest Profile\Service Worker\CacheStorage"
rd /s /q "%LocalAppData%\Microsoft\Edge\User Data\Default\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%LocalAppData%\Microsoft\Edge\User Data\Default\Service Worker\CacheStorage"
rd /s /q "%LocalAppData%\BraveSoftware\Brave-Browser\User Data\Default\Service Worker\CacheStorage" >> %logfile% 2>&1
echo "%date%" > "%LocalAppData%\BraveSoftware\Brave-Browser\User Data\Default\Service Worker\CacheStorage"
REM stop Teams from automatically starting up
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v com.squirrel.Teams.Teams /f