Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

Cleaning up disk space on Windows servers

Written by: on 25 February 2021 12:14 PM 25 February 2021 12:14 PM

Windows by default stores all files you have ever replaced by updates so you can rollback / uninstall updates if you need to. This is largely unnecessary as it's very very rare for you to need to uninstall an update or service pack.

This can take up quite a few GBs of data, however, these files can be safely and easily removed using powershell.

If you have a service pack installed, you can remove the old files from storage by opening powershell and typing the command:

dism /online /cleanup-image /SPSuperseded

Once that is complete, you can then cleanup any old files from newer updates by typing:

dism /online /cleanup-image /StartComponentCleanup

On Windows 2012 R2 or greater you should run this command to remove all superseded files for all components:

dism /online /cleanup-image /StartComponentCleanup /ResetBase

Once dism has set Windows update to a new base, you can clean up the softwaredistribution folder, this is where most of your disk space will be taken. To do that you need to open a command prompt as administrator by typing 'cmd' into the start button search, right clicking on 'Command' and choosing 'Run as Administrator':


Then type the following commands:

net stop wuauserv
net stop bits
del c:\windows\SoftwareDistribution /q /s
net start wuauserv
net start bits
(0 vote(s))
Helpful
Not helpful