Skip to content

Commit 7b66b10

Browse files
authored
Major Update!
1 parent 60a03e1 commit 7b66b10

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Powershell/Clear-SCOMCache.ps1

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
PS C:\> $agent = Get-SCOMClass | where-object{$_.name -eq "microsoft.systemcenter.agent"}
1818
1919
PS C:\> #Get the grey agents
20-
PS C:\> $objects = Get-SCOMMonitoringObject -class:$agent | where {$_.IsAvailable -eq $false}
21-
PS C:\> .\Clear-SCOMCache.ps1 -Servers $objects
20+
PS C:\> $objects = Get-SCOMMonitoringObject -class:$agent | where {$_.IsAvailable -eq $false} | .\Clear-SCOMCache.ps1 -Servers $objects.DisplayName
21+
PS C:\> .\Clear-SCOMCache.ps1 -Servers $objects.DisplayName
2222
2323
Clear SCOM cache on every Management Server in Management Group.
2424
PS C:\> Get-SCOMManagementServer | .\Clear-SCOMCache.ps1
2525
2626
Clear SCOM cache on every Agent in the in Management Group.
2727
PS C:\> Get-SCOMAgent | .\Clear-SCOMCache.ps1
28-
29-
Clear SCOM cache on the Servers specified.
30-
PS C:\> .\Clear-SCOMCache.ps1 -Servers IIS-Server.contoso.com, MS2.contoso.com
31-
28+
3229
Clear SCOM cache and reboot the Servers specified.
3330
PS C:\> .\Clear-SCOMCache.ps1 -Servers IIS-Server.contoso.com, MS2.contoso.com -Reboot
3431
@@ -274,8 +271,8 @@ PROCESS
274271
catch
275272
{
276273
Time-Stamp
277-
Write-Host "[Warning] :: " -NoNewline
278-
Write-Host "$_" -ForegroundColor Yellow
274+
Write-Host "[Info] :: " -NoNewline -ForegroundColor DarkCyan
275+
Write-Host "$_" -ForegroundColor Gray
279276
Time-Stamp
280277
Write-Host "Attempting to Delete Folder: `"$healthservice`\Health Service State`" "
281278
try
@@ -474,7 +471,7 @@ PROCESS
474471
}
475472
else
476473
{
477-
<# Edit line 448 to modify the default command run when this script is executed.
474+
<# Edit line 479 to modify the default command run when this script is executed.
478475
479476
Example:
480477
Clear-SCOMCache -Servers Agent1.contoso.com, Agent2.contoso.com, MS1.contoso.com, MS2.contoso.com

0 commit comments

Comments
 (0)