title: SQL Server failover cluster - determine active node
body: <p>Is there a way to <strong>programmatically determine which node in a SQL Server failover cluster is the active node</strong>? Or at least determine whether the current machine is the active node?</p>
  
  <p>I have a Windows program which runs on both physical nodes in a failover cluster, but that should operate differently depending on whether it is running on the active node. <strong>Part of the reason is that this program should not run simultaneously on the inactive and the active node</strong>.</p>
  
  <p>(I've read a bit about making the program cluster aware, but that seems heavily overkill for this simple scenario.)</p>