I'm trying to automate -vmswapdatastore location on my cluster and so far I managed to add single datastore that can be used. Problem is i can't figure out how to add multiple datastores that are allocated to swapfile datstores on my cluster.
here is my code:
connect-viserver vcenter
foreach ($vmhost in get-cluster "clustername" | get-vmhost)
{ Get-vmhost $vmhost | set-vmhost -vmswapfiledatastore "VS01" }
this works perfectly but I can't add more of them and if i try to add another one it just replaces the current one with new one. so how would i go about adding vs02 and vs03 to the datstores?
What is the trick to doing this?
thanks