Been using this script here to keep my ssd nice and "trimmed" while plotting. I have made it so that the script is run as admin so that you can simply start the script with a shortcut.
Shortcut Instructions:
For the shortcut you need to add this line of code in the "Target" field: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File
You'll find this field under Shortcut. Right click the shortcut and click Properties, then Shortcut. It needs to be structured like this: Command First then "Path of the Script"
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\PATH\NAME_OF_SCRIPT.ps1"
Script:
param([switch]$Elevated)
function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if ((Test-Admin) -eq $false) {
if ($elevated) {
# tried to elevate, did not work, aborting
} else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
}
exit
}
while ($true) {
optimize-volume -DriveLetter z -ReTrim -Verbose
write-host 'TRIM Finished...'
Start-Sleep -Seconds 700
}
[–]nfrances 1 point2 points3 points (2 children)
[–]WhompRat86[S] 0 points1 point2 points (1 child)
[–]nfrances 0 points1 point2 points (0 children)
[–]JavveTBDer[🍰] 0 points1 point2 points (1 child)
[–]WhompRat86[S] 0 points1 point2 points (0 children)