Windows 10 (solved) How to Trigger Trim in Windows (via powershell, command prompt, Scheduled task)

  • Thread starter Thread starter tutudids
  • Start date Start date
T

tutudids

Guest
At command prompt or via task, run for example:

Code:


"C:\WINDOWS\system32\dfrgui.exe" /defrag \\?Volume\{8baf4df1-246b-11e9-91df-806e6f6e6963}


dfrugui.exe /defrag commandline intelligently triggers the trim command for SSD's. But first you will need your drive GUID. I will provide you with two ways, 1a), and 1b)

1a)

Run, mountvol.exe at command prompt, copy all of the results, hit start+r, run for example, "\\?Volume\{8baf4df1-246b-11e9-91df-806e6f6e6963" without quotes to determine the partition in explorer. Replace the volume GUID at the top of this page with your own, test it at command prompt. Note every SSD partition, even if there is more than one on a single drive.


1b)


Download/Run "Process Monitor", filter using 'process name' dfrgui.exe, run trim on each SSD partition to note the command and CLSID for your drive volumes. I had to open one instance of dfrgui.exe for every partition... otherwise dfrgui runs the command on the first drive scanned, over and over again! The program is buggy or intentionally broken. I have told windows to trim daily automatically and it hasn't done it in 8 days it says when I last did it manually.


2)

Take all TRIM drive commands, placed them in a .bat file and run them from powershell, command & or task scheduler.

Example WindowsTrim.bat


Code:



"C:\WINDOWS\system32\dfrgui.exe" /defrag \\?\Volume{b9b773fd-cfa1-11e8-94a0-021b2b02fe63}\
"C:\WINDOWS\system32\dfrgui.exe" /defrag \\?\Volume{9357aabe-3e27-11e4-93c6-806e6f6e6963}\
"C:\WINDOWS\system32\dfrgui.exe" /defrag \\?\Volume{38b9a427-2030-11e9-9ac8-021b2b02fe63}\
"C:\WINDOWS\system32\dfrgui.exe" /defrag \\?\Volume{748e2c57-2036-11e9-92db-021b2b02fe63}\

Not sure what windows 7 does but if there is a similar gui for optimizing SSD's, run ProcMon there as well.

Oddly, on a subsequent ProcMon test the command showed "dfrgui f:" instead... which does not work at prompt, so try until you get the command.

This is great for privacy and security; get rid of those pesky bugs & rootkits that write to empty space. (Source? me)

More...
 
Back
Top