How can I automate removal of Windows.old after a Windows 25H2 upgrade?

0
1
Asked By MapleOrbit42 On

I need to reclaim disk space on hundreds of systems that were recently upgraded to Windows 25H2. Cleanmgr can remove the previous installation interactively, but I haven't found a reliable way to automate that cleanup. I also tried combining DISM, takeown, icacls, and Remove-Item, but junction loops caused errors and prevented the directory from being removed. What is the safest way to perform this remotely without logging into each machine?

4 Answers

Answered By QuietHarbor7 On

Avoid taking ownership and manually deleting Windows.old. Junctions and protected system folders can cause the process to follow paths it shouldn’t, and changing permissions may damage ownership or ACLs on other parts of the system. Test any cleanup method on a small pilot group first.

Answered By SilverNoodle31 On

Windows normally removes the previous installation automatically once the rollback period ends, which is commonly around 10 days, though the exact timing can vary. If you need the space sooner, use a Storage Sense policy or the scripted cleanmgr preset rather than manually deleting the folder.

AmberPiano64 -

I’ve seen it take closer to 10 days in practice, so I wouldn’t rely on the automatic cleanup if disk space is urgent.

Answered By VelvetKite88 On

Cleanmgr can be scripted through its registry-backed presets. On a test machine, run `cleanmgr /sageset:777`, select Previous Windows installation(s), and save the settings. Then deploy the corresponding StateFlags777 registry value under `HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorerVolumeCachesPrevious Installations` and run `cleanmgr /sagerun:777` with administrative privileges.

CedarBlink5 -

That’s probably the route I’ll use if the installation cleanup doesn’t happen automatically after the rollback window expires.

Answered By OrbitingFox23 On

Storage Sense policies are another option if you already manage them centrally. Configure the policy to remove previous Windows installations and let the devices process it on their normal maintenance schedule. The `/autoclean` switch is sometimes suggested, but it may not work consistently for this scenario.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.