Showing posts with label Build and Capture. Show all posts
Showing posts with label Build and Capture. Show all posts

Friday, September 6, 2013

Powershell Script to delete all elements in Configuration Manager client cache

You may need to delete all elements in Configuration Manager client cache. Here it is in a Powershell way:

#Delete all elements in Configuration Manager client cache

$CMObject = New-Object -ComObject "UIResource.UIResourceMgr"
$CMCacheObjects = $CMObject.GetCacheInfo()
$CMCacheElements = $CMCacheObjects.GetCacheElements()

Foreach ($CacheElement in $CMCacheElements) 
    {
    $CMCacheObjects.DeleteCacheElementEx($CacheElement.CacheElementID)
    }