After installing Windows updates I have a routine I go through to clear out all the left over garbage. I delete C:\$WinREAgent\ if it exists, then run Disk Cleanup, clicking the button to get rid of unneeded system files. Then at a command prompt running as Admin. [you can use Terminal as well] I use the command: dism /online /Cleanup-Image /StartComponentCleanup
. On about 1/2 of our devices so far this month it quits with an error that it can't change properties on a file. Tried a few things, finding that it works to run DISM cleanup while running another copy of Windows, e.g., a Windows To Go drive -- not sure if it'll work booting to WinPE, though it should. In this case the command is: DISM /Image:X:\ /cleanup-image /startcomponentcleanup
where X = the drive letter for the copy of Windows you want to clean. Afterward DISM cleanup works fine in that copy of Windows, though there's really nothing for it to do, so I'm assuming there's a problem with one of the leftover files. Checking the Windows\ WinSxS\ folder before & after running DISM cleanup from the WinToGo drive, it removed 3GB+ worth of old files.
After DISM cleanup, FWIW, I clean with Microsoft PC Mgr., clear the 2 temp folders [Windows & Users], & delete Windows\ SoftwareDistribution\ Download\.