Skip to content

Instantly share code, notes, and snippets.

@danjpadgett
Last active April 9, 2018 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danjpadgett/fb8b5eedbb9def08b19c5a5e2590d044 to your computer and use it in GitHub Desktop.
Save danjpadgett/fb8b5eedbb9def08b19c5a5e2590d044 to your computer and use it in GitHub Desktop.
<#
.SYNOPSIS
Checks WSUS App Pool
.DESCRIPTION
Script will check status of WSUS APP Pool and if 'stopped' will email. Setup script as scheduled task on WSUS instance.
.NOTES
Version: 1.0
Author: dpadgett
Creation Date: 07/02/17
Purpose/Change: Production
#>
$smtpserver = "<hostname/IP>"
$recipients = "<mailrecipient>"
$senderaddress = "<sender>"
Import-Module WebAdministration
Get-ChildItem –Path IIS:\AppPools
$pools = 'WsusPool'
$state = Get-ItemProperty "IIS:\AppPools\$($pools[0])" | select state
$body = "WSUS App Pool on SCCM Site Server '<ConfigMgr Server>' has stopped - Please log in to to manually start "
if ($state -match 'Started')
{
#Null
}
else
{
Send-MailMessage -SmtpServer $smtpserver -Port 25 -To $recipients -From $senderaddress -Subject "WSUS App Pool Error on SCCM Site Server!" -Body $body
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment