none
Power on server groupwise RRS feed

  • Question

  • Hi,

    I have a command to power on first 10 VM's from a hypervisor who hold 200+VMs and the command works well.

    But can anyone tell me how can I convert this in a loop, so that after first 10 VM poweron it will give 20 second waiting and then will start another 10 and again wait for 20 second and proceed with another 10 sets and complete all 200+ VM's in this format.

    Can anyone help me here ?

    Get-Cluster -name <clustername> | Get-ClusterResource | where { $_.Name -and $_.state -eq "offline"} | Select-Object -First 10 | Start-ClusterResource


    • Edited by Mcteer Friday, October 13, 2017 9:06 AM
    • Moved by Bill_Stewart Wednesday, November 29, 2017 6:34 PM Help vampire
    Friday, October 13, 2017 9:04 AM

All replies

  • Use a loop.  Add "sleep 10"  - run loop on all systems that are not running until all have completed.


    \_(ツ)_/

    Friday, October 13, 2017 9:12 AM
  • I have tried something like this, but not working

    do{
        Get-Cluster -name <clustername> | Get-ClusterResource | where { $_.Name -and $_.state -eq "offline"} | Select-Object -First 10 | Start-ClusterResource
        start-sleep -Seconds 20
    }until($infinity)



    • Edited by Mcteer Friday, October 13, 2017 10:16 AM
    Friday, October 13, 2017 10:11 AM
  • Why are you checking if the $_.name is is equal to "offline"?
    Friday, October 13, 2017 1:02 PM
  • Why are you checking if the $_.name is is equal to "offline"?

    That checks if Name is not null.


    \_(ツ)_/

    Friday, October 13, 2017 1:15 PM