Hi All,
New to the forum, and never knew it existed…
We receive requests to migrate multiple VMs between clusters and data-centers. I have the code setup to do the migrations with no issue, and manually put the VM names into a text file, and then update the code with the target cluster. I am trying to automate the process so other people do not have to touch the code.
I am doing the Read-Host -Prompt and putting the o/p into the text file to read. However, I cannot figure out how to put multiple lines in and then have the cluster next to the VM name as a target.
E.G… VM1234567 Cluster-12345
VM234455 Cluster-23456
The snippet of code I am using is:
Read-Host -Prompt ‘Type name of VM and cluster name that will be migrated’ | Out-File -FilePath C:\TEMP\vm_list.txt -Append
This gives me 1 VM and 1 target cluster name.
I have tried to loop but it is not working.
Any help would be appreciated.
Gary