I have the need to restart Microsoft SQL Server's group of services on a given computer, remotely, through some sort of programmatic method I can insert into a workflow. I'm looking for the best way to do this, I've seen a few different ways and I'm wondering if there's anything I'm missing:

  • Use Net Stop and Net Start - This would work if I only needed to restart the SQL Service and there were no dependencies, not really an option if SQL Server Agent is running.
  • Use SC //<computername This would allow me some access into the servicecontroller so I could query whether or not there's a dependent service running.
  • Use the .NET Servicecontroller method, which would let me build an array of services running on the target computer and then iterate through them to stop what I need to stop.

Am I missing any ways?

1 Answer 1


Please see http://technet.microsoft.com/en-us/library/hh403394.aspx - you missed for example PowerShell.

Pay extra attention if you're using a clustered instance.

  • So many different ways to do the same thing. Since Powershell's a .NET language I could use servicecontroller or the WMI stuff (as referened there). Definitely a good link though.
    – Sean Long
    Mar 6, 2014 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.