-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathfsutil.ps1
22 lines (19 loc) · 946 Bytes
/
fsutil.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# NTFS filesystem tweaks
# Thanks to: https://notes.ponderworthy.com/fsutil-tweaks-for-ntfs-performance-and-reliability
# NOTE: You may want to adapt your drive letters. This script assumes C: and D: letters are used
# Privilege Escalation
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
exit;
}
fsutil behavior set memoryusage 2
fsutil behavior set disablelastaccess 1
fsutil behavior set mftzone 2
$DriveLetters = (Get-WmiObject -Class Win32_Volume).DriveLetter
ForEach ($Drive in $DriveLetters){
If (-not ([string]::IsNullOrEmpty($Drive))){
Write-Host Optimizing "$Drive" Drive
fsutil resource setavailable "$Drive":\
fsutil resource setlog shrink 10 "$Drive":\
}
}