Blog Post

PowerShell Script to restart SQL Services

,

This article gives PowerShell script to restart the SQL Server service, SQL Server Agent, Reporting Service (SSRS), and SQL Server Integration Services 15.0.

Take the script from ,GitHub and execute it in the Windows PowerShell IDE.

PowerShell Script to restart SQL Services

If you want to create a batch file, save the PS file as RestartSQLServices.ps1 in the C:SQL directory.

Launch notepad and copy-paste the following code.

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:SQLRestartSQLServices.ps1""' -Verb RunAs}"

Save the file as SQLServiceRestart.bat. The batch script looks like below.

SQL Service restart batch file

You can double-click on the batch file, and it restarts the SQL Services.

Original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating