PowerShell Script to restart SQL Services
top of page
Writer's picturerajendra gupta

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,699 views0 comments

Recent Posts

See All
bottom of page