Skip to content

Clearing cache during OSD?

Featured Replies

Anyone know of the best method for clearing cache on a machine mid-OSD? I have a lab of machines I would like to deploy OS and some large apps (IE: CAD, Adobe CS, etc.), but don't have a ton of disk space, and would rather not clear post deployment.

 

Thanks in advance!

Do you mean you want to clear out the temp directory?

We have a step in our task sequence that removes and recreates the c:\temp folder (others as well) and cleans out the windows\temp folder.

 

Just add a group called Cleanup
in it, put a few Run Command Line steps with their commands:

(For Cleanup c:\temp) cmd /c rd /s /q c:\temp

(For Create c:\temp directory) cmd /c md c:\temp

(For Cleanup c:\windows\temp) cmd /c del /f /q c:\windows\temp\*.*

(For Cleanup c:\perflogs) cmd /c del /f /q c:\perflogs*.*

(For Cleanup Windows Update directories) cmd /c del /f /q c:\windows\softwaredistribution\datastore\*.* & cmd /c del /f /q c:\windows\softwaredistribution\download\*.*

(For Cleanup ConfigMgr logs) cmd /c del /f /q c:\windows\ccm\logs\*.*

(For Cleanup Event Logs) powershell.exe -executionpolicy bypass -command "& {wevtutil el | Foreach-Object {write-host "Clearing $_"; wevtutil cl "$_"}}"

  • Author

Do you mean you want to clear out the temp directory?

We have a step in our task sequence that removes and recreates the c:\temp folder (others as well) and cleans out the windows\temp folder.

 

Just add a group called Cleanup

in it, put a few Run Command Line steps with their commands:

(For Cleanup c:\temp) cmd /c rd /s /q c:\temp

(For Create c:\temp directory) cmd /c md c:\temp

(For Cleanup c:\windows\temp) cmd /c del /f /q c:\windows\temp\*.*

(For Cleanup c:\perflogs) cmd /c del /f /q c:\perflogs*.*

(For Cleanup Windows Update directories) cmd /c del /f /q c:\windows\softwaredistribution\datastore\*.* & cmd /c del /f /q c:\windows\softwaredistribution\download\*.*

(For Cleanup ConfigMgr logs) cmd /c del /f /q c:\windows\ccm\logs\*.*

(For Cleanup Event Logs) powershell.exe -executionpolicy bypass -command "& {wevtutil el | Foreach-Object {write-host "Clearing $_"; wevtutil cl "$_"}}"

 

 

Thank you for the reply, I appreciate it! I think these commands will come in handy going forward. We probably should be cleaning things up for all deployments whether space is an issue or not.

you might want to consider adding a delay of a week or so to the cleanup of some folders, for example C:\Windows\Temp as many applications logs are logged to their or the appdata\local\temp equivalent, so troubleshooting failed installs of apps might be a challenge if the logs are deleted,

 

just a thought

  • 3 weeks later...
  • Author

you might want to consider adding a delay of a week or so to the cleanup of some folders, for example C:\Windows\Temp as many applications logs are logged to their or the appdata\local\temp equivalent, so troubleshooting failed installs of apps might be a challenge if the logs are deleted,

 

just a thought

 

I just saw this reply, but that's actually a good thought, because I do reference those logs fairly often. Thanks for the reply!

  • 9 years later...

Each application install within the task sequence has a button to delete its cache after the install. It's at the bottom "Clear application content from cache after installing". Not good for Self-repair apps like VLC.

I know this is a 10 year old thread but its top result of google, so leaving it for others.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.