dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Stop-DbaSqlService

Stops the SQL Server related services on one or more computers. Will follow SQL Server service dependencies.

Requires Local Admin rights on destination computer(s).

Screenshots

dbatools - Stop-DbaSqlService

Examples

Stops the SQL Server related services on computer sqlserver2014a.

Stop-DbaSqlService -ComputerName sqlserver2014a

Gets the SQL Server related services on computers sql1, sql2 and sql3 and stops them.

‘sql1′,’sql2’,’sql3’| Get-DbaSqlService | Stop-DbaSqlService

Stops the SQL Server services related to the default instance MSSQLSERVER on computers sql1 and sql2.

Stop-DbaSqlService -ComputerName sql1,sql2 -Instance MSSQLSERVER

Stops the SQL Server related services of type “SSRS” (Reporting Services) on computers in the variable MyServers.

Stop-DbaSqlService -ComputerName $MyServers -Type SSRS

Stops SQL Server database engine services on sql1 forcing dependent SQL Server Agent services to stop as well.

Stop-DbaSqlService -ComputerName sql1 -Type Engine -Force

Author

This command was created by Kirill Kravtsov. You can find Kirill on Twitter.

Get-Help

From PowerShell, execute Get-Help Stop-DbaSqlService -Detailed for more information on this function.

Source Code

Want to see the source code? View Stop-DbaSqlService.ps1 on GitHub
 

Related commands