Skip to content

Clear ConfigMgr Client Cache PS

Featured Replies

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.

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.