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


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.




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


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.

From PowerShell, execute   Get-Help Get-DbaClusterActiveNode -Detailed   for more information on this function. Want to see the source code? See it on GitHub