C:\Windows\WinSxS\Temp\InFlight\ Deleting Empty Folders


The built in "defragger"(CP/WindowsTools/Defragment optimize..).: I set that to defrag once a week. It senses that these are SSDs and trims them, SO ONE HUGE PROBLEM TAKEN CARE OF!!!!!!!!!!! - imho SSDs should be trimmed on a regular basis!!!

If Scheduled for Optimization it's trimmed on a weekly basis (but one can change that) - and will also run a traditional defrag on a monthly basis (even on SSD) - if to fragmented. Here's the schedule parameters:

  • When run from the scheduled task, defrag uses the below policy guidelines for SSDs:
    • Traditional optimization processes. Includes traditional defragmentation, for example moving files to make them reasonably contiguous and retrim. This is done once per month. However, if both traditional defragmentation and retrim are skipped, then analysis isn't run. Changing the frequency of the scheduled task doesn't affect the once per month cadence for the SSDs.
    • If you manually run traditional defragmentation on an SSD, between your normally scheduled runs, the next scheduled task run performs analysis and retrim, but skips traditional defragmentation on that SSD.
    • If you skip analysis, you won't see an updated Last run time in the Optimize Drives app. Because of that, the Last run time can be up to a month old.
    • You might find that scheduled task hasn't defragmented all volumes. This is typically because:
      • The process won't wake the computer to run.
      • The computer isn't plugged in. The process won't run if the computer is running on battery power.
      • The computer is resumed from being idle.

On Home PC have it Disabled - but usually run TRIM manually on a weekly basis. Depends what i'm doing: if writing/deleting lots of Data (or even after a Windows or Driver Updates), if about to install a huge app (or game) - i'll run a manual Trim. Even fragmented it's still fast enough (for home use / i don't use it for streaming recordings or large date transfers and such). Have other SSD sanitary practices - like using the RAM even for web cache (Firefox). Or storing big media files on an external HDD. But is it worth it?! Maybe not for everyone - since again SSDs are more affordable this days. But that's just me (my way of doing things). Still, wouldn't recommend defragmenting the SSD habitually. Since mine was disabled - was never defragmeted by Windows fo far (in past 5 years) - but i do run an app called PriVazer for indepth cleaning once a month or two - and some of its free space clearing features help a bit in this regard.
 

My Computer My Computer

At a glance

WinDOS 25H2Intel & AMDSO-DIMM SK Hynix 15.8 GB Dual-Channel DDR4-26...nVidia RTX 2060 6GB Mobile GPU (TU106M)
OS
WinDOS 25H2
Computer type
Laptop
CPU
Intel & AMD
Memory
SO-DIMM SK Hynix 15.8 GB Dual-Channel DDR4-2666 (2 x 8 GB) 1329MHz (19-19-19-43)
Graphics Card(s)
nVidia RTX 2060 6GB Mobile GPU (TU106M)
Sound Card
Onbord Realtek ALC1220
Screen Resolution
1920 x 1080
Hard Drives
1x Samsung PM981 NVMe PCIe M.2 512GB / 1x Seagate Expansion ST1000LM035 1TB
and will also run a traditional defrag on a monthly basis (even on SSD) - if to fragmented. Here's the schedule parameters:
This is not the case.

The follow part from microsoft site at the bottom of the page defrag
When run from the scheduled task, defrag uses the below policy guidelines for SSDs:
  • Traditional optimization processes. Includes traditional defragmentation,
Is badly formulated.

If you look at the scheduled task, it is started with the following parameters:
1739750666196.webp

/cPerforms the operation on all volumes.
/c Means that is is run on all volumes, if it is ssd or traditonal disk.

/hRuns the operation at normal priority (default is low).
/h not importent..

/oPerforms the proper optimization for each media type.
/o Means, that when a ssd is detected it will retrim it. When diskdrive is detected with will defrag is.

To put it to the test, you can simply run the command in console.
1739750939714.webp

The result is, that SSD is detected, and it is retrimming the SSD disk, and NOT performing a defragmentation.

It will not start a defragmentation on SSD's. If SSD's are correctly detected (not always the case!)
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
Come for the technical article (from a MS dev), stay for the🔥flame war🔥 in the comments.

TLDR; Windows defrag has been smart about SSD's for a few years now. But the official MS docs suck...
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
This is not the case.

The follow part from microsoft site at the bottom of the page defrag

Is badly formulated.

If you look at the scheduled task, it is started with the following parameters:
View attachment 125607

/cPerforms the operation on all volumes.
/c Means that is is run on all volumes, if it is ssd or traditonal disk.

/hRuns the operation at normal priority (default is low).
/h not importent..

/oPerforms the proper optimization for each media type.
/o Means, that when a ssd is detected it will retrim it. When diskdrive is detected with will defrag is.

To put it to the test, you can simply run the command in console.
View attachment 125611

The result is, that SSD is detected, and it is retrimming the SSD disk, and NOT performing a defragmentation.

It will not start a defragmentation on SSD's. If SSD's are correctly detected (not always the case!)

Couldn't check - cause i Disabled and removed that policy from Task Scheduler in the week after installing Windows 11 (the tweaking week :).

Doesn't sound poorly formulated:

If you manually run traditional defragmentation on an SSD, between your normally scheduled runs, the next scheduled task run performs analysis and retrim, but skips traditional defragmentation on that SSD.

At least not English-wise, so if it's a case of misinformation on Microsoft's official learning site - what can i say.... 🤷‍♂️

From the article linked by garlin:

"When he says volume snapshots or "volsnap" he means the Volume Shadow Copy system in Windows. This is used and enabled by Windows System Restore when it takes a snapshot of your system and saves it so you can rollback to a previous system state. I used this just yesterday when I install a bad driver. A bit of advanced info here - Defrag will only run on your SSD if volsnap is turned on, and volsnap is turned on by System Restore as one needs the other. You could turn off System Restore if you want, but that turns off a pretty important safety net for Windows."

Then again, it's an almost 11 year old article - so maybe they changed some defrag parameters. Don't have any SATA3 SSDs around (in case - those are treated differently), but on the NVMe one - Windefrag doesn't even allow me to run Analyze.

Still have an HDD attached and used many Defrag Tools along the years (MyDefrag, Defraggler, Auslogic, O&O Defrag, etc) - but this days i use mostly WinContig (a bit confusing for first time users - since you can add "a folder" to be analyzed and defragmented - but that feature to add folder - is also how you chose/add a partition to be degfragmented). Similar to Defraggler - i use it only to select the defragmented files for defragmentation (not the whole partition). Defraggler is actually what i used before - but got some errors and there's no updates to fix them (it's basically a dead project for past 7 years). WinConting is still updated/maintained - it's really lite and works.
 

My Computer My Computer

At a glance

WinDOS 25H2Intel & AMDSO-DIMM SK Hynix 15.8 GB Dual-Channel DDR4-26...nVidia RTX 2060 6GB Mobile GPU (TU106M)
OS
WinDOS 25H2
Computer type
Laptop
CPU
Intel & AMD
Memory
SO-DIMM SK Hynix 15.8 GB Dual-Channel DDR4-2666 (2 x 8 GB) 1329MHz (19-19-19-43)
Graphics Card(s)
nVidia RTX 2060 6GB Mobile GPU (TU106M)
Sound Card
Onbord Realtek ALC1220
Screen Resolution
1920 x 1080
Hard Drives
1x Samsung PM981 NVMe PCIe M.2 512GB / 1x Seagate Expansion ST1000LM035 1TB
Have been rolling out it on more and more machines. Have not seen any issues in the past month. Did run the script a few times on machines where i have runned it one time, and always it returned 0 files deleted.

Now that updates are done, retesting the script after i did dism cleanup actions.

So after this months update;
Code:
Total empty folders deleted across all iterations: 4569

So will be scheduling this script a few days after patch day.
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
I used to use Raxco Perfectdisk (they've closed down now due to the advent of SSD's) on the old W7 system and it was a great app.
Redundant with SSD's though, in fact does more harm than good.
Once a month trim is fine.
 

My Computer My Computer

At a glance

Windows 11 Pro 24H2i7 Ultra16GBIntel
OS
Windows 11 Pro 24H2
Computer type
Laptop
Manufacturer/Model
LG
CPU
i7 Ultra
Memory
16GB
Graphics Card(s)
Intel
Sound Card
Intel Realtek
Monitor(s) Displays
Laptop 17" & TB4 Dell 27" QHD Ultrasharp w/integral TB4 hub
Screen Resolution
2560x1600
Hard Drives
1TB SSD, 5 external WDs
Mouse
Logitech Master MX 3S
Browser
Vivaldi
Antivirus
Kaspersky Premium Suite
I am trying to delete folders under C:\Windows\WinSxS\Temp\InFlight on my Windows 11 ARM64 system but so far have had no luck.
I download your file Invoke-WinSxSTempCleanup.psm1 but do not know how to run it. Any help would be greatly appreciated.
 

My Computer My Computer

At a glance

Windows 11 ARM64Snapdragon(R) X 12-core X1E80100 @ 3.40 GHz 3...64.0 GB (63.5 GB usable)
OS
Windows 11 ARM64
Computer type
Laptop
Manufacturer/Model
Microsoft Surface Pro 11
CPU
Snapdragon(R) X 12-core X1E80100 @ 3.40 GHz 3.42 GHz
Memory
64.0 GB (63.5 GB usable)
Monitor(s) Displays
Surface laptop & Samsung 30"
Screen Resolution
1920 X 1080
Hard Drives
500 GB SSD
Case
Laptop
Keyboard
Logi
Mouse
Microsoft Comfort Mouse
Internet Speed
Download 24.39 Mb/s
Browser
Firefox & Edge
Antivirus
Malwarebytes
Back
Top Bottom