We’ve got an application that regularly errors with a 500 HTTP status code. To fix the error we need to recycle the app pool (until the vendor extracts a digit and sorts the issue). I’ve implemented a recovery task on the ‘Web Application Availability Monitoring Test - Web Application Monitor’ to run some PowerShell:
$password = ConvertTo-SecureString "password goes here" -AsPlainText -Force $cred= New-Object System.Management.Automation.PSCredential ("domain\username here", $password) Enter-PSSession -ComputerName servername here -Credential $cred Restart-WebAppPool "AppPool name here"
The PS works when I run it on the server, or call it remotely with WinRM from a SCOM Management Server, but it isn’t triggering when the alert for the 500 error is raised. Any ideas what I’m doing wrong, and where I can find some logged information for this? I can’t find anything in the Operations Manager or PowerShell logs on either the SCOM Management servers or the server that has the issue.
Unfortunately, the 500 error doesn’t leave any evidence on the server that I could use to trigger a task from instead of using the web monitor alert. Also, I know the way I’m passing credentials isn’t ideal, but I just want to get this working before I look at securing it better!