Jump to content


Sign in to follow this  
joeman1881

Clearing cache during OSD?

Recommended Posts

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!

Share this post


Link to post
Share on other sites


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 "$_"}}"

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...