Skip to content

Instantly share code, notes, and snippets.

@danjpadgett
Last active April 9, 2018 15:49
Embed
What would you like to do?
<#
.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