dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Get-DbaClusterActiveNode

Returns the Windows Server name of active node of a SQL Cluster.

If -Detailed is specified, details including node name, status, status description, and current owner (basically, everything in sys.dm_os_cluster_nodes) are also returned if the cluster is SQL Server 2012 and above. Older SQL Server versions will only display the node names.

Screenshots

get-dbaclusteractivenode

Examples

To return the Windows Server (ComputerNamePhysicalNetBIOS) name of the current owner

Get-DbaClusterActiveNode -SqlServer sqlcluster

To show additional deals such as status, and all nodes in the cluster

Get-DbaClusterActiveNode -SqlServer sqlcluster -Detailed

Note

This has only been tested on a 2-node cluster but has been written to support clusters with additional nodes. Please let us know your experience.

Get-Help

From PowerShell, execute Get-Help Get-DbaClusterActiveNode -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaClusterActiveNode.ps1 on GitHub
 

Related commands