Restarting SQL Server's services remotely programmatically 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 //&lt;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?
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.