PowerShell

MSCLUSTER 2008 Cluster Commandline

Display cluster resources.

cluster [group | res]
PS> [Get-ClusterGroup | Get-ClusterResource] -Cluster "<CLUSTERNAME>"
PS> Get-ClusterGroup -Cluster "<CLUSTERNAME>" | Where-Object { $_.OwnerNode -eq "<CLUSTERNODE>" } | SELECT Name

Move a cluster group to a different node.

cluster group "Cluster Group" /moveto:<NODENAME>
PS>  Move-ClusterGroup -Name "Cluster Group" -Cluster "<CLUSTERNAME>" -Node "<CLUSTERNODE>"

Display all registered nodes for a resource.

cluster res "SQL Network Name (NETWORKNAME)" /listowners
PS> Get-ClusterOwnerNode -Cluster "<CLUSTERNAME>" -Resource "<CLUSTERRESOURCE>

Bring cluster group online…

PS> Start-ClusterGroup -Name "<CLUSTERGROUPNAME>"

Switch a AlwaysOn Group to a secondary replica…

Switch-SqlAvailabilityGroup -Path SQLSERVER:\SQL\[SERVER]\[INSTANCE]|DEFAULT\AvailabilityGroups\[AOGROUP]

Change witness fileshare on a NodeAndFileMajority cluster. First change to NodeMajority and then back to NodeAndFileMajority using the new fileshare.

PS> Set-ClusterQuorum -NodeMajority
PS> Set-ClusterQuorum -NodeAndFileShareMajority \\server\fswitness$\clustername