Powershell script to check SQL service status and send email

In windows server we can create a PowerShell script to trigger an email on the basis of SQL service status. Solution Below The solution for checking the status of SQL Server service can be achieved by using the “Get-Service” cmdlet. In the below example we are using some common naming conventions of SQL server like MSSQL$, MSSQLSERVER, and SQL Server, etc. below code is to get the server status. Note: please check your SQL server name and replace them “MSSQLSERVER” in below code To send email we will use some…

Read More