5

I'm running the following simple Powershell command.

$Server = New-Object ('Microsoft.SqlServer.Management.Smo.Server') 'SerName'
$Server | SELECT *

For FCI clusters the ClusterName value is always blank and the ClusterQuorumState and ClusterQuorumType are always NotApplicable. IsClustered is set to True though.

If I run it against an Availability Group I get back the cluster name and the correct values for the other two properties.

Is there a way in Powershell to get the cluster name for the FCI instances? Another cmdlet I can use?

1

No need to load up the Smo object, you can query WMI to get this

gwmi -Query "select Name from cim_cluster" -namespace root\mscluster -computername [computername] | select Name
  • To keep code consistent for how I've been doing it so far, I haven't been using -query, would I call it like this? "gwmi -Class CIM_Cluster -Namespace root\MSCluster -ComputerName [ComputerName]" That works but I'm not sure if there is a class I can call without using the -namespace. – MrTCS Feb 27 '17 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.