Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Output from powershell not ordered as expected

$
0
0

Hi there,

I have a powershell which will list all the SQL clusters in a domain with their corresponding nodes etc but it doesn’t output that info in the structured way I was expecting of cluster name followed by that clusters’ nodes sequentially. Any ideas how to straighten that out?

$cluster = Get-Cluster -domain xxxx.com 

$cluster | foreach-object {
        write-host "$_"
        Get-ClusterNode -Cluster $_.Name
        } 

This gives me the correct information but sequenced like:-

Cluster1
Cluster2

cluster1 node1
cluster1 node2
cluster 2 node1
cluster2 node2

Instead of the below:-

Cluster1
cluster1node1 cluster1node2

Cluster2
Cluster2node1
Cluster2node2

Many thanks for looking.

Cheers,

rob


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>