Some times the WSUS server on SCCM can stop. If the WSUSPool in IIS Application pools is stopped, WSUS will not function and SCCM will not update any clients.
In anticipation of further troubleshooting, here is a workaround script to check the Application Pool and start it if it is not running. This script can be adapted to check any IIS application pool.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
<# .SYNOPSIS Checks if IIS Pool is running and restarts pool if not running and emails report. .DESCRIPTION Checks if IIS Pool is running and restarts pool if not running and emails report. .NOTES File Name : Repair-WebAppPoolState.ps1 Author : Jan Ryen (mail (at) janryen.com) Prerequisite : PowerShell V3 and above. Copyright 2019 - Jan Ryen #> ################################## #Requires -Version 3 #Requires -Modules WebAdministration #Requires -Modules PowerShellLogging # Import module Import-Module WebAdministration Import-Module PowerShellLogging # Define variables $EmailFrom = "sccm@test.lan" $EmailTo = "user@test.lan" $SMTPServer = "smtp.test.lan" #Set up event logging New-EventLog -LogName Application -Source "Repair-WebAppPoolState" -ErrorAction SilentlyContinue function Repair-WebAppPoolState { #Get the correct Application Pool name $apn = "WsusPool" $date = get-date $ComputerName = $env:computername If ((get-WebAppPoolState -name $apn).Value -eq "Stopped") { Write-Host "Failure detected, attempting to start it" Start-WebAppPool -name $apn Start-Sleep -s 10 If ((get-WebAppPoolState -name $apn).Value -eq "Stopped") { $subject = "Application Pool Restart Failed" Write-Host $subject $EmailBody = "App Pool $apn restart on $ComputerName failed - no clients will get updates `n $date" Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $subject -body $EmailBody -SmtpServer $SMTPServer Write-EventLog -LogName Application -Source "Repair-WebAppPoolState" -EntryType Error -EventID 1 -Message "App Pool $apn restart on $ComputerName failed - no clients will get updates `n $date" } else { $subject = "Application Pool Restarted" Write-Host $subject $EmailBody = "App Pool $apn on $ComputerName was not running, it has been started. `n $date" Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $subject -body $EmailBody -SmtpServer $SMTPServer Write-EventLog -LogName Application -Source "Repair-WebAppPoolState" -EntryType Warning -EventID 1 -Message "App Pool $apn on $ComputerName was not running, it has been started. `n $date" } } else { Write-Host "Application Pool $apn is already running" Write-EventLog -LogName Application -Source "Repair-WebAppPoolState" -EntryType Information -EventID 1 -Message "Application Pool $apn is already running" } } Repair-WebAppPoolState |