Have you ever needed to remotely clean the ccmcache folder on a computer? This blog article will explain how:
Step 1 - Add following PowerShell script in Software Library > Scripts:
## 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))
}
[__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))
}
Step 2 - In the Configuration Manager (SCCM/MECM) console, locate the computer.
Step 3 - Click it with the right mouse button and select Run Script > Select the Script you added > Next.
Step 4 - Wait for the process to complete, and monitor Script Status Monitoring for output.
No comments:
Post a Comment