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:
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.
SC //<computernameThis would allow me some access into the
servicecontrollerso I could query whether or not there's a dependent service running.
- Use the .NET
Servicecontrollermethod, 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?