title: Recursive reboots on VMware machines
body: <p>I want to automate a recursive reboot of a set of VMs every Sunday, using the vSphere CLI.</p>
  
  <p>My current code performs a one time reboot on one server, I could write multiple lines or include multiple servers in the same code but I am looking to involve a sequence in this.</p>
  
  <p>I do not want the second VM to be rebooted before the first one successfully reboots and comes up.</p>
  
  <pre><code>Import-Module VMware.VimAutomation.Core
  Connect-VIServer -Server &lt;server&gt; -User &lt;user&gt; -Password &lt;password&gt;
  Restart-VM &lt;vm_name&gt; -RunAsync -Confirm:$false
  </code></pre>