VMware Cloud Community
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Powershell equivalent for the following VBScript to determine cluster active node ?

Hi Everyone,

I'm wondering if there is another similar Powershell script which can determine the current active node of a MSCS ?

the following is done on VBScript

strClusterWMINameString = "winmgmts:\\ExchangeServerCluster01\root\cimv2"
Set objWMISvc = GetObject( strClusterWMINameString )
Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
For Each objItem in colItems
    strComputerName = objItem.Name
    WScript.Echo "The Cluster " & strClusterWMINameString & " active node is " & strComputerName
Next

Any kind of help is appreciated.

Thanks.

/* Please feel free to provide any comments or input you may have. */
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

In PowerShell you can do this with:

(Get-WmiObject Win32_ComputerSystem -Computer SIEXCLU01).Name


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
2 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

In PowerShell you can do this with:

(Get-WmiObject Win32_ComputerSystem -Computer SIEXCLU01).Name


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Many thanks Rob, you are ScriptKing !

/* Please feel free to provide any comments or input you may have. */
0 Kudos