Calling Powershell scripts from C# to monitor IIS Application pool
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9LcxKsrks8u-PDh-FmAaURP2V-zYb5PL7fKGDxg0oUrT0R2mhw_nphFEJupI_-AP2HeSxB0RZXhEI2xwmagwRpOA1dZgt97e-5QDHES0Yx6QLMFxNtUKlrBDpZf6Dz6AcstGM0lZy51FQwzRZj4aqEt8vMweVv2Wf2YL_kHUv_WP4BpGqqO1Ap1DX/s320/Powershell-335x150.png)
Hi All, I recently had a requirement to monitor an application pool in one of our server and if it is gets stopped for some odd reason it must be restarted automatically. I created a windows application to achieve this task. The following are two methods which I used to check the status and if it is stopped to start the application pool. private string GetpoolStatus(string computerName,string appPoolName) { Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(); PowerShell powershell = PowerShell.Create(); PSCommand command = new PSCommand(); string result = ""; ScriptBlock scriptBlock = ScriptBlock.Cre...