Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

SOLVED clear ccm cache ps script

erikdeklerck

Active Member
Messages
27
Reaction score
1
Points
3
Hello everyone :

when executing this script on a local machine it clears the ccm cache :
## Initialize the CCM resource manager com object
[__comobject]$CCMComObject = New-Object -ComObject 'UIResource.UIResourceMgr'## Get the CacheElementIDs to delete
$CacheInfo = $CCMComObject.GetCacheInfo().GetCacheElements()## Remove cache items
ForEach ($CacheItem in $CacheInfo) {
$null = $CCMComObject.GetCacheInfo().DeleteCacheElement([string]$($CacheItem.CacheElementID))
}

but not when deploying by sccm, any suggestions or other scripts ?
 
Based on this articel we are looking for a automated script to clear the ccm cache

when creating a package and deploying to a single device nothing is cleared.
 
Last edited:
Based on this articel we are looking for a automated script to clear teh ccm cahce

when creating a package and deploying to a single device nothing is cleared.
And if you run the script manually on the machine, does it work ?.
 
Thx...this is good solution for post install but we need a pre-install task to make sure the cache is cleared for deploy of applications
Yes that link applies if you are deploying a TS and clear out the cache after installing apps.
 
Clean-CMClientCache.log : error 0x87D01203
Ccmexec is in use while the script tries to clear the cache.
So we could start a script form the client directly that starts another script that clears the cache and performs an exit ?
 
Clean-CMClientCache.log : error 0x87D01203
Ccmexec is in use while the script tries to clear the cache.
So we could start a script form the client directly that starts another script that clears the cache and performs an exit ?
Where are you seeing this error? this doesn't look like it is coming from execmgr.log. Also this error says that something is running from the cache on no from the DP, like you said above.
 
I have over 250 GB of manual cache and I do not know what it contains, should I delete it, it takes up 25% of my SSD?
What problem are you trying to solve?
 
Hello,

I as well am tying to find a script for powershell that clears the ccmcache but no luck. Can anyone be of assistance?
 
I use this PS to clean the ccmcache when needed:

## Initialize the CCM resource manager com object [__comobject]$CCMComObject = New-Object -ComObject 'UIResource.UIResourceMgr' ## Get the CacheElementIDs to delete $CacheInfo = $CCMComObject.GetCacheInfo().GetCacheElements() ## Remove cache items ForEach ($CacheItem in $CacheInfo) { $null = $CCMComObject.GetCacheInfo().DeleteCacheElement([string]$($CacheItem.CacheElementID)) }

I run it as a script from the console when needed.
 
$UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr
$Cache = $UIResourceMgr.GetCacheInfo()
$Cache.GetCacheElements() |
foreach {
$Cache.DeleteCacheElement($_.CacheElementID)
}
 
$UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr
$Cache = $UIResourceMgr.GetCacheInfo()
$Cache.GetCacheElements() |
foreach {
$Cache.DeleteCacheElement($_.CacheElementID)
}
What is your question?
 

Forum statistics

Threads
7,196
Messages
28,081
Members
18,354
Latest member
davidluong

Trending content

Back
Top