SMO Server.ClusterName Property

Category: sql server smodmo

Question

precept33 on Wed, 12 Oct 2016 01:09:07


The ClusterName property returns an empty string when issued against a clustered SQL Instance/Windows Clustering (shared storage)

$servername = 'clusteredsqlname\namedinstance'

$server = New-Object "Microsoft.SqlServer.Management.Smo.Server" $servername

$server.ClusterName

returns blank

However it does return the windows cluster name when issued against an AlwaysON Instance/Windows Clustering(non shared storage)

$servername = 'AlwaysONListener\namedinstance'

$server = New-Object "Microsoft.SqlServer.Management.Smo.Server" $servername

$server.ClusterName

returns the name of the windows cluster

Both return "True" for isClustered property. Is this a bug or am I missing something here?

https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.server.aspx

Replies

Hilary Cotter on Wed, 12 Oct 2016 01:38:17


It looks like this is by design:

https://connect.microsoft.com/SQLServer/feedback/details/741750/microsoft-sqlserver-management-smo-wmi-managedcomputer-does-not-populate-services-property-for-cluster

Hi -- This is by design. Using the ManagedComputer you will have to connect to the physical machine, not the cluster name.

Albert_ Zhang on Wed, 12 Oct 2016 03:15:48


Hi precept33,

As supplementary, I have found following similar thread that you could have a look at it. As it says, Shared memory and VIA are not supported on failover clusters in SQL Server.

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/560e70d3-d71f-4337-8797-b0b1c6267d8f/cannot-connect-to-clustered-sql-instance-using-shared-memory?forum=sqlsmoanddmo

Best Regards,

Albert Zhang


precept33 on Wed, 12 Oct 2016 03:41:41


Albert.

I am not running the powershell commands off of the cluster itself. I am connecting from another server which acts as our inventory/CMS server so shared memory is not possible :-) and VIA protocol is not enabled. I am connecting using the SQLClusterNetworkName\instanceName. It connects just fine. The issue is the SMO Server property "ClusterName" as it returns a blank value where as other properties such as "IsClustered" return a value. It appears Hilary Cotter may be on to something....

Albert_ Zhang on Wed, 12 Oct 2016 07:33:37


Hi precept33,

Thank you for clearing the issue. If Hilary Cotter’s reply is helpful to you, you could mark it as answer to thank him for his help and close this thread, so that it would useful to others who have the same issue. Thank you again.

Best Regards,

Albert Zhang