For Server 2008 r2 and High
Run
DISM /online /Cleanup-Image /StartComponentCleanup
You may need to start trusted installer before hand
net start TrustedInstaller
Run COMPCLN
Server 2008
Run : COMPCLN.EXE
Task Scheduler (Local) –> Task Scheduler Library –> Microsoft –> Windows –> Servicing –> StartComponentCleanup
dism.exe /Online /Cleanup-Image /RestoreHealth
sfc /scannow
In an elevated command prompt, exec these 2 commands
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe %systemroot%\System32
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui %systemroot%\System32\en-US
You can then invoke disk cleanup the normal way – type cleanmgr
and hit enter.
Dism.exe /online /Cleanup-Image /StartComponentCleanup then: Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase