Contents
Article last updated on April 12th, 2023
How to get it
Clear-SCOMCache.ps1 Direct Download Link
or
Personal File Server - Clear-SCOMCache.ps1 Alternative Download Link
or
Personal File Server - Clear-SCOMCache.txt Text Format Alternative Download Link
The script without any modifications or parameters clears the Operations Manager cache only on the local server, nothing else.
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. |
Examples
Clear all Gray SCOM Agents
#Get the SystemCenter Agent Class
$agent = Get-SCOMClass | where-object{$_.name -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 AgentServer.contoso.com, ManagementServer.contoso.com -Reboot
Clear SCOM cache and shutdown the Servers specified
.\Clear-SCOMCache.ps1 -Servers AgentServer.contoso.com, ManagementServer.contoso.com -Shutdown
Share on: