Orchestrator reboots (2 minutes apart) of all (70) servers in an SCCM collection

CABraun 21 Reputation points
2020-10-20T21:51:10.767+00:00

Hi there.

I have a couple of different runbooks that handle orchestrated reboots of servers with timing based on which SCCM device collection they are in.

Servers in Collection A get rebooted at 8PM, Servers in Collection B get rebooted at 8:30PM, Servers in Collection C get rebooted at 9PM.

That was pretty easy to setup and the reboot times are written to a SQL DB which another runbook queries the DB periodically and performs the reboot for anything scheduled at that time.

This is different though because the servers are all part of the same device collection and I want to reboot them about 120 seconds apart. Reboot order does not matter, just that I don't cause a huge boot storm on my Hyper-V hosts by rebooting 70 (more in the future) VMs all at the exact same time. I am having trouble figuring out the best way (and a way that works) to take the list of servers in the SCCM Collection and write them to either a file or a DB and how to tell SCO to Reboot the 1st server at 8:00PM, the 2nd server 120 seconds later, the 3rd server 240 seconds after the 1st (or 120 seconds after the 2nd) ... the 70th server 8400 seconds after the 1st (or 120 seconds after the 69th).

I don't think I should need to have 70 "Format Date/Time" Activities each one adding 120 seconds to the previous. Surely there is a better way to do this.

System Center Orchestrator
System Center Orchestrator
A family of System Center products that provide an automation platform for orchestrating and integrating both Microsoft and non-Microsoft IT tools.
215 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 97,566 Reputation points MVP
    2020-10-21T06:10:38.973+00:00

    In my opinion the easiest way to get a "foreach scenario" done in an Orchestrator Runbook is a PowerShell Script.

    Get the x servers from a SCCM collection. This is the "input" for the PowerShell Script.
    Set the delay time variable to "0" at the beginning of the script
    Use a foreach loop in the script for all x servers and add 120 seconds each "loop" to the delay time variable
    Reboot each server with the calculated delay (The HyperV cmdlet should support the input of a delay time)
    https://learn.microsoft.com/en-us/powershell/module/hyper-v/restart-vm?view=win10-ps

    That is the approach I would try.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments