Cleaning up disk space on Windows servers
Posted by Will Kruss on 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:
Once that is complete, you can then cleanup any old files from newer updates by typing:
On Windows 2012 R2 or greater you should run this command to remove all superseded files for all components: 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':
| |
|