top of page
No tags yet.

SEARCH BY TAGS: 

RECENT POSTS: 

FOLLOW ME:

  • Facebook - Black Circle
  • Twitter - Black Circle
  • Instagram - Black Circle
  • LinkedIn - Black Circle

Powershell: Stop SQL Server Cluster Resource


We could use this sign when we have approved downtime for upgrades.

So this isn't exactly just for SQL, this cmdlet can be used stop and start any clustered service.

It proved especially useful for me since I am currently on a project that requires the systematic stoppage of clustered SQL Services so that the storage team can do their thing.

As always, test this in a non production environment before implementing during a migration.

Prerequisite: Import the failover clusters module. This can only be done on a server with Failover Clustering installed. Which means you may have to open a Powershell remote session to one of the nodes.

First, we would need to identify the cluster resources.

Get-Clusterresources

Or you can find just the resources on a particular node

Get-ClusterNode -name NODE1 | Get-ClusterResources

Then stop the cluster resource (note, stopping the SQL Server service, will also stop the SQL Agent. You need to remember this when starting the services).

Stop-ClusterResource -name "SQL Server (MSSQLSERVER)"

Remember to start any dependent services as well:

Start-ClusterResource "SQL Server (MSSQLSERVER)"

Start-ClusterResource "SQL Server Agent (MSSQLSERVER)"

Finally, if you have a number of resources that need to be stopped, use the Get-Clusterresources cmdlet to create a text file containing all the resources that you want affected. Then use a loop.

  • Facebook - Black Circle
  • Twitter Round
  • Instagram Black Round
  • LinkedIn - Black Circle
bottom of page