Automation

 View Only
  • 1.  Start VM to slow !

    Posted Nov 24, 2008 01:36 PM

    Hello,

    I have a script to startup all my vm.

    $vm = get-vm |where-object{$_.PowerState -eq "PoweredOff"}

    $vm |ForEach-Object{

    start-vm $_.name

    }

    This is work fine but it 's to slow for start 200 VM (more 2 hours).

    It s possible to launch multiple startup ?

    Thanks for your help !



  • 2.  RE: Start VM to slow !

    Posted Nov 24, 2008 01:43 PM

    Sure, this is easy. Just add a -RunAsync to the end of the Start-VM command. This will queue the requests in a number of seconds and the VC or hostd will take care of the rest.

    Also, a tip, well two tips:

    1. when embedding code into a forum post, it works best if you use the tags "" at the start and "" at the end (remove the spaces between the tag name and the braces). You put asterisks and such in the code below which may make it look better while posting it but it tends to mix up things and make resulting code invalid.

    2. start-vm $_.name is unnecessary. $_ is a VM object, and start-VM knows what to do with them. "start-vm $_" is sufficient.






    [PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

    Author of the upcoming book: Managing VMware Infrastructure with PowerShell

    Co-Host, PowerScripting Podcast (http://powerscripting.net)

    Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org



  • 3.  RE: Start VM to slow !

    Posted Nov 24, 2008 01:55 PM

    Thank for your answer. i 'll test it the next sunday.

    For my next post, i 'll use your comments to post my code.