Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 217440

Re: How to pass parameters in a variable in a loop FOREACH ?

$
0
0

Those lines should be in a foreach loop, like the earlier code in the script.

Then the $_ variable will hold the number to be added to the basename.

2..$Count | Foreach {
  $vm = Get-VM "$Name$_"
  while ($vm.PowerState -ne "PoweredOn"){    sleep 5
    $vm = Get-VM $vm
  }
}

This will wait for all VM to be powered on.


Viewing all articles
Browse latest Browse all 217440

Trending Articles



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