Skip to main content


Showing posts from September, 2016

Google Search

Custom Search

Live Search

Yahoo Search

Search the web Search this site

Monitoring Windows Services using PowerShell

Recently I was interested in finding a way to monitor a windows service. What I needed was to check whether the service is running and if not running get a notification and try to restart the service. Following PowerShell script does exactly that, it checks for Microsoft CRM Asynchronous Service and the Microsoft CRM Asynchronous Maintenance Service activity and send 2 emails to Admin and Dev. This needs to be then scheduled using Windows Task Scheduler or SQL Server Job.### Checking for CRM Async and Maintenance service failure and try restarting, if failing send an email notification.## Function to send mail notification.function Send_Email ([string]$strEmailSubject, [string]$strEmailBody){$EmailFrom = ""$EmailTo = ","$EmailSubject = $strEmailSubject$EmailBody = $strEmailBody$EmailSMTPServer = ""## Creating Mail Message object.