Skip to content

Instantly share code, notes, and snippets.

@bryandam
Forked from danjpadgett/CheckWSUSAppPool
Created April 9, 2018 13:55
Show Gist options
  • Select an option

  • Save bryandam/aa2a349729abba7f7d838477077d99ef to your computer and use it in GitHub Desktop.

Select an option

Save bryandam/aa2a349729abba7f7d838477077d99ef 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','SMS Management Point Pool'
$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
}
$state = $null
$state = Get-ItemProperty "IIS:\AppPools\$($pools[1])" | select state
$body = "SMS Management Point 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 "SMS Management Point 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