SCOM Clear Cache Script

Posted by : on

powershell   operationsManager

Article last updated on April 12th, 2023

:arrow_down: How to get it

Clear-SCOMCache.ps1 :arrow_left: Direct Download Link
Personal File Server - Clear-SCOMCache.ps1 :arrow_left: Alternative Download Link
Personal File Server - Clear-SCOMCache.txt :arrow_left: Text Format Alternative Download Link

The script without any modifications or parameters clears the Operations Manager cache only on the local server, nothing else.

:classical_building: Argument List

Parameter Description
-All Optionally clear all caches that SCOM could potentially use that doesnt require a reboot. Flushing DNS, Purging Kerberos Tickets, Resetting NetBIOS over TCPIP Statistics. (Combine with -Reboot for a full clear cache)
-Reboot Optionally reset winsock catalog, stop the SCOM Services, clear SCOM Cache, then reboot the server. This will always perform on the local server last.
-Servers Optionally each Server you want to clear SCOM Cache on. Can be an Agent, Management Server, or SCOM Gateway. This will always perform on the local server last.
-Shutdown Optionally shutdown the server after clearing the SCOM cache. This will always perform on the local server last.
-Sleep Time in seconds to sleep between each server.

:question: Examples

Clear all Gray SCOM Agents

#Get the SystemCenter Agent Class
$agent = Get-SCOMClass | where-object{$ -eq "microsoft.systemcenter.agent"}
#Get the grey agents
$objects = Get-SCOMMonitoringObject -class:$agent | where {$_.IsAvailable -eq $false}
.\Clear-SCOMCache.ps1 -Servers $objects

Clear SCOM cache on every Management Server in Management Group

Get-SCOMManagementServer | .\Clear-SCOMCache.ps1

Clear SCOM cache on every Agent in the Management Group

Get-SCOMAgent | .\Clear-SCOMCache.ps1

Clear SCOM cache and reboot the Servers specified

.\Clear-SCOMCache.ps1 -Servers, -Reboot

Clear SCOM cache and shutdown the Servers specified

.\Clear-SCOMCache.ps1 -Servers, -Shutdown

Page Views

Share on:
About Blake Drumm
Blake Drumm

I like to collaborate and work on projects. My skills with Powershell allow me to quickly develop automated solutions to suit my customers, and my own needs.

Email :

Website :

About Blake Drumm

My name is Blake Drumm, I am working on the Azure Monitoring Enterprise Team with Microsoft. Currently working to update public documentation for System Center products and write troubleshooting guides to assist with fixing issues that may arise while using the products. I like to blog on Operations Manager and Azure Automation products, keep checking back for new posts. My goal is to post atleast once a month if possible.

Follow @blakedrumm
Useful Links