PowerShell_Scripts icon indicating copy to clipboard operation
PowerShell_Scripts copied to clipboard

how to determine cluster node ?

Open chipitsine opened this issue 9 years ago • 0 comments

hello,

I've writter simple script

cls

. "C:\xxx\Get-SQLInstance.ps1"

'running on: {0}' -f  $env:Computername
'---------------'

Get-SQLInstance -Computername $env:Computername | % {
    $_.ComputerName
}

I expected it to show cluster node (an owner of cluster application). However, it shows current computer all the time:

running on: SRV-SQL01-DCA
---------------
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA
SRV-SQL01-DCA

PS C:\Windows\system32> 

actually, I checked, cluster instances are distributed across several nodes.

chipitsine avatar Sep 05 '16 16:09 chipitsine