Jump to content


LeeF

Clear ConfigMgr Client Cache PS

Recommended Posts

This may very well overlap a few topics but I have a need for a PS script that I can assign to a Configuration Item and a Configuration Baseline. I have the PS scripts but need advice how to run the script as it fails due to the fact by default CM Clients run at the level of All Signed.

I thought I could just add at line 1 Set-ExecutionPolicy ByPass within the remediation script as follows

Set-ExecutionPolicy ByPass
$MinDays = 14
$UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr
$Cache = $UIResourceMgr.GetCacheInfo()
$Cache.GetCacheElements()|
where-object {[datetime]$_.LastReferenceTime -lt (get-date).adddays(-$mindays)}| foreach {$Cache.DeleteCacheElement($_.CacheElementID)}

 

Any advice on if anyone has a better way of doing this.

 

Issue to resolve is the Client Cache length of time that the cache stays in the Client\Cache\CCMCache folder chewing up disk space. Especially on Servers that have been provisioned with only 80GB primary partitions.

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


×
×
  • Create New...