Skip to content

Commit 8b73914

Browse files
author
Blake Drumm
authored
Update Clear-SCOMCache.ps1
1 parent cfc9926 commit 8b73914

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

Powershell/Clear-SCOMCache.ps1

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
<#
22
.SYNOPSIS
3-
Clear-SCOMCache
4-
3+
Clear-SCOMCache
4+
55
.DESCRIPTION
6-
The script clears the SCOM cache, Flushing DNS, Purging Kerberos Tickets, Resetting NetBIOS over TCPIP Statistics, and Resetting Winsock catalog. And reboots the server(s) if -Reboot switch is present.
7-
6+
The script clears the SCOM cache, Flushing DNS, Purging Kerberos Tickets, Resetting NetBIOS over TCPIP Statistics, and Resetting Winsock catalog. And reboots the server(s) if -Reboot switch is present.
7+
88
.PARAMETER Servers
9-
Each Server you want to Clear SCOM Cache on, can be an Agent, Management Server, or SCOM Gateway.
10-
9+
Each Server you want to Clear SCOM Cache on, can be an Agent, Management Server, or SCOM Gateway.
10+
1111
.PARAMETER Reboot
12-
Optionally reboot the server after stopping the SCOM Services and clearing SCOM Cache.
13-
12+
Optionally reboot the server after stopping the SCOM Services and clearing SCOM Cache.
13+
1414
.EXAMPLE
15-
Clear SCOM cache on every Management Server in Management Group.
15+
Clear SCOM cache on every Management Server in Management Group.
1616
PS C:\> Get-SCOMManagementServer | %{.\Clear-SCOMCache.ps1 -Servers $_}
17-
18-
Clear SCOM cache on every Agent in the in Management Group.
17+
18+
Clear SCOM cache on every Agent in the in Management Group.
1919
PS C:\> Get-SCOMAgent | %{.\Clear-SCOMCache.ps1 -Servers $_}
2020
21-
Clear SCOM cache and reboot the Servers specified.
21+
Clear SCOM cache and reboot the Servers specified.
2222
PS C:\> .\Clear-SCOMCache.ps1 -Servers IIS-Server.contoso.com, MS2.contoso.com -Reboot
23-
24-
.AUTHOR
25-
Blake Drumm (v-bldrum@microsoft.com)
26-
27-
.MODIFIED
28-
May 24th, 2021
23+
24+
.AUTHOR
25+
Blake Drumm (v-bldrum@microsoft.com)
26+
27+
.MODIFIED
28+
May 24th, 2021
29+
30+
.NOTES
31+
Additional information about the file.
2932
#>
33+
[OutputType([string])]
3034
param
3135
(
3236
[Parameter(Mandatory = $false,
37+
ValueFromPipeline = $true,
3338
Position = 1,
34-
ValueFromPipeline)]
39+
HelpMessage = 'Each Server you want to Clear SCOM Cache on, can be an Agent, Management Server, or SCOM Gateway.')]
3540
[Array]$Servers,
3641
[Parameter(Mandatory = $false,
37-
Position = 2)]
42+
Position = 2,
43+
HelpMessage = 'Optionally reboot the server after stopping the SCOM Services and clearing SCOM Cache.')]
3844
[Switch]$Reboot
3945
)
4046

@@ -1395,7 +1401,7 @@ if ($Servers -or $Reboot)
13951401
}
13961402
else
13971403
{
1398-
<# Edit line 1403 to modify the default command run when this script is executed.
1404+
<# Edit line 1409 to modify the default command run when this script is executed.
13991405
14001406
Example:
14011407
Clear-SCOMCache -Servers Agent1.contoso.com, Agent2.contoso.com, MS1.contoso.com, MS2.contoso.com

0 commit comments

Comments
 (0)