top of page

PowerShell Script to restart SQL Services

Updated: Jan 12, 2022

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:\SQL\RestartSQLServices.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.



2,519 views0 comments

Comments


bottom of page