Remote commands or running scripts on a set of computers based on a script run on another computer

I’m trying to figure out how to automate patching. We have certain servers that need to reboot if certain other servers reboot.

My first thought was simply WMI calls or Invoke-Command -ScriptBlock type scripts, but as the scripts are run as local SYSTEM, it has no authority to query network computers.

The only other thing I could think of would be to run a script on one server, and based on the results of that script, launch a script on a different set of servers. Is this possible to do in Automox?

Get #1 to push the reboot status to #2 rather than #2 having to query #1 (since you mentioned permission issues due to SYSTEM context). So one possible solution:

#1. On the servers that have rebooted, perhaps create a scheduled task that dumps a reboot status file to a folder share?

#2. On the servers that need to reboot based on #1, check that folder share.

#3. Grant readonly access to EVERYONE on the folder share, and read/write access to the context under which the scheduled task of #1 runs?

Another approach would be to use Automox API to pass the data around (you could use TAGs).

Just remember that #2 may end up rebooting multiple times unnecessarily if the status of #1 is not updated on-time. For example, #1 has scheduled task to tag itself as needing reboot. This scheduled task runs every 60minutes. If #2 checks #1 every 15 minutes, it would end up rebooting 4 times. This logic shouldn’t be difficult to handle. Easiest way would be to use different time durations e.g. #1 = 15minutes, #2 = #60minutes.

1 Like