improve detection of space savings

This commit is contained in:
2026-10-23 11:22:55 -04:00
parent ec9141d062
commit c5ef81dfca
4 changed files with 181 additions and 7 deletions
+39 -6
View File
@@ -32,7 +32,7 @@ Run once with `CleanupReportOnly=true`, then set it to `false` to apply. Report
mode assesses **all categories regardless of their enablement**, using the current
retention settings. It leaves the enablement variables unchanged. The compact
report starts with the unique enabled savings and additional disabled savings,
then lists every category once in three sections:
followed by three diagnostic lines, then every category once in three sections:
- **Enabled:** eligible for cleanup on an apply run, subject to the reported conditions.
- **Disabled:** potential savings only; these categories will not run during apply
@@ -58,6 +58,32 @@ categories are labeled incomplete. In-use application checks remain enforced, so
close those applications and rerun to obtain their estimates. Unknown savings are
excluded from the totals, and file sizes do not guarantee physical space savings.
The report-only diagnostics run regardless of the corresponding cleanup flags:
- **Hibernation:** current system-drive `hiberfil.sys` size in GiB, or explicitly
"not present". An inspection failure is unavailable, not an absent file.
- **ShadowStorage:** used and allocated GiB for the system volume's shadow-storage
association, including the drive where that data resides. Storage on another
drive is labeled accordingly; it does not represent space occupied on C:.
No registered association and failed/unsupported CIM queries are distinguished.
- **ComponentStore:** a short note that removing superseded updates may free
substantial space, or little/none. The component store is not analyzed, and no
Yes/No recommendation or package count is calculated. The note appears even if
`CleanupComponentStore=false` or `CleanupDiskCleanupItems=None`.
These are **current usage and potential, not extra reclaimable bytes**;
they are excluded from both savings totals. VSS data may be shared between
snapshots, and the script retains the newest snapshot. Hibernation/VSS diagnostics
remain unassessed on servers under the existing server policy. The component-store
note appears on both clients and servers. Diagnostics are skipped in
apply mode and require no new Syncro variables.
Report mode does not launch DISM analysis, avoiding its additional runtime on slow
endpoints. Component cleanup removes superseded updates, so potential savings
depend on accumulated updates and previous Windows maintenance. A large WinSxS
folder alone does not indicate how much is reclaimable. Actual cleanup still uses
the existing background task when `CleanupComponentStore=true` in apply mode.
The default output is designed for Syncro's limited script output: one line per
category, including zero results, without a second PowerShell object dump or
per-category progress chatter. Column sizes are in MiB; positive sizes below
@@ -74,10 +100,11 @@ Syncro variable is required. The `Invoke-SystemCleanup` function still returns
structured results for programmatic callers; the script entry suppresses their
automatic formatting after printing the human-readable report.
Report mode does not delete files, change registry settings, stop services,
launch maintenance programs, or request scheduled maintenance. Acquiring a named
mutex prevents overlapping runs; the RMM bootstrap still downloads Tools/core
and may produce its usual logs. Native cleanup savings cannot be estimated.
Report mode performs no cleanup, changes no cleanup registry settings, stops no
services, launches no native programs, and requests no scheduled maintenance.
Acquiring a named mutex prevents overlapping
runs; the RMM bootstrap still downloads Tools/core and may produce its usual logs.
Native cleanup savings cannot be estimated from these usage measurements alone.
Boolean options accept native booleans or true/false, yes/no, 1/0 strings. Blank
or unrecognized boolean values fail before cleanup. Retention values must be
@@ -230,9 +257,15 @@ totals for overlapping categories, and disabled categories remaining untouched i
apply mode. Preset tests verify exact handler membership, cumulative selections,
RMM scope preservation, None disabling native work, and the server exclusions.
Output tests cover the duplicate-object regression, a 22-category preview under
4 KiB, separate enabled/disabled sections, and preservation of diagnostic notes.
4 KiB including diagnostics, separate enabled/disabled sections, and preservation
of diagnostic notes. Regression checks ensure DISM analysis is absent and report
diagnostics launch no native programs.
Hibernation/VSS tests cover absence, access failures, cross-drive storage, server
exclusions, and usage staying out of savings totals.
References: [OS ProductType](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem),
[Disk Cleanup](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr),
[component cleanup](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder),
[component analysis](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/determine-the-actual-size-of-the-winsxs-folder?view=windows-11),
[shadow-storage measurements](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/vsswmi/win32-shadowstorage),
[Windows Search](https://learn.microsoft.com/troubleshoot/windows-client/shell-experience/windows-search-performance-issues).