Several operations measure or mutate drive C directly (Get-PSDrive C and vssadmin ... /for=C:), while other paths correctly use $env:SystemDrive. Windows can be installed on another drive, so totals and restore-point cleanup can target the wrong volume. Derive one system-drive name from $env:SystemDrive, use it for every measurement and command, and cover a non-C system drive in tests.
Several operations measure or mutate drive C directly (
Get-PSDrive Candvssadmin ... /for=C:), while other paths correctly use$env:SystemDrive. Windows can be installed on another drive, so totals and restore-point cleanup can target the wrong volume. Derive one system-drive name from$env:SystemDrive, use it for every measurement and command, and cover a non-C system drive in tests.