Purge the SCCM cache with Windows PowerShell

Publié le par Charlie

Here is a Windows PowerShell sequence to clear the SCCM cache

CAUTION: These Windows PowerShell commands destroy the contents of the SCCM cache.

1. Sequence number 1 with PowserShell
--------------------------------------------------------------------------------
# Sequence number 2

$SCCMClient = New-Object -ComObject "UIResource.UIResourceMgr";
($SCCMClient.GetCacheInfo()).GetCacheElements() |

% { ($SCCMClient.GetCacheInfo()).DeleteCacheElement($_.CacheElementId) };

--------------------------------------------------------------------------------

2. Script number 1 with PowserShell ISE
--------------------------------------------------------------------------------
# Script number 1

$SCCMClient = New-Object -ComObject "UIResource.UIResourceMgr"
($SCCMClient.GetCacheInfo()).GetCacheElements() | 
ForEach-Object {

($SCCMClient.GetCacheInfo()).DeleteCacheElement($_.CacheElementId)

}
--------------------------------------------------------------------------------

 

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article