$Clusters = Import-Csv -Path $ClusFilePath #Loop the clusters in the file Foreach($Cluster in $Clusters) { $ClusterName = $Cluster.ClusterName $Result = GetClusterServers $ClusterName If($Result -ne $null) { #Export the server the cluster $Result|Out-File -FilePath $OutFilePath -Append $flag ++ } }
$Clusters = Import-Csv-Path $ClusFilePath#Loop the clusters in the fileForeach($Clusterin$Clusters) { $ClusterName = $Cluster.ClusterName $Result = GetClusterServers $ClusterNameIf($Result-ne $null) { #Export the server the cluster$Result|Out-File -FilePath $OutFilePath-Append $flag++ } }
Example 3: Get all servers in the specified clusters in
CSV file and store them in specified file.
Command: Out-OSCClusServers -ClusFilePath
'c:\OneScript\ClusNames.csv' -OutFilePath c:\OneScript\result.csv
Screenshot:
Note: The CSV file format should be like this.
ClusterName
mac-clus
abc
Windows PowerShell 2.0
Related forum threads:
Script to report on a MSCS Cluster server