I would like to do a script to automatically configure a Cluster Hyper-V / CVS and other operations.
To do that i have the list of the server in a file ListSrv.txt.
So i create an array to put all the server in.
After i would like to do the Test of validity beforecreating the ckuster with the command Test-Cluster -Node…,
I need ton concat the $TabSrv[0] “Add a “,”” with $TabSrv[1]“Add a “,”” if there is another server etc…
To do automatically this commande like that :
May I recommend to change from plain text file as your source to a csv file. It’s easier to store structured data and it’s even easier to access these structured data in Powershell. This csv file could look like this:
OK, I think I misunderstood you. It’s not about several clusters it’s just about one cluster with several nodes, right? Nothing easier than that (almost)
If you have an array of elements (strings) you can join them with the -join statement. Assumed you use your listserv.txt file you could do something like this: