Using the Task Scheduler in BatchPatch

BatchPatch really shines when it comes to providing real-time control and monitoring of the Windows Update process, reboots, software deployments, and remote script execution on numerous computers. But what if you want to execute tasks while you’re sleeping? For sysadmins it’s extremely common to have to perform tasks on servers at off-hours, often in the middle of the night. We’re all used to staying up through the middle of the night to perform various maintenance routines, but there are plenty of times we’d rather be lying in bed and letting our computers perform scheduled tasks for us! Needless to say, scheduled tasks are absolutely *not* appropriate for every situation. Many times a task is too critical to be executed without human oversight, but in the cases where something is less critical, why not let BatchPatch handle it for you in the middle of the night?

For example, let’s say that you have some servers that aren’t super-critical, but they still get used a lot and can’t be easily taken down during the day. Perhaps on these servers it’s safe for you to schedule an update + reboot in the middle of the night? Obviously that is your decision to make, and you always have to be prepared for something to go wrong. However, assuming you’ve decided that you want to run updates/reboots in the middle of the night, here’s how you can do it with BatchPatch.

  1. Highlight your hosts in the BatchPatch grid, and then select ‘Actions > Task scheduler > Create/modify scheduled task.’ You’ll see the Task Scheduler appear.
    2015-02-17 15_09_52-new 1 - BatchPatch X3
  2. In the drop-down menu, select the task that you want to perform. For the sake of this example, we’re going to use “Download and install updates + reboot if required.” However, you can choose any BatchPatch task, including any of the custom commands or scripts that you’ve previously created. After selecting the desired task, set the run time, and then click OK.
  3. We can see that there is a task and time applied to each row that we had previously selected, but we’re not quite done. The task scheduler is disabled by default. So, even though we setup task actions and run times, we have to enable the scheduler in order for our tasks to be submitted for execution at the desired times. To enable the scheduler, click on the small clock/timer icon in the upper right corner of the BatchPatch window. The icon will turn from red to green, indicating that the scheduler has been enabled.
    2015-02-17 15_10_58-Program Manager
  4. Note, you can set the scheduler to be always-on, if you want, so that you don’t have to manually enable it. Go to ‘Tools > Settings > General’ and select the checkbox to ‘Enable Task Scheduler on startup.’
    2015-02-17 15_21_30-Program Manager
  5. That’s all there is to it. The scheduled tasks will run at the designated times. What if you want to receive an email of the grid activity? We agree that it would be convenient to wake up in the morning and check your email to see how things went. In this case, one option is to create an additional row in the grid with a new task that will be responsible for emailing you an HTML report of the grid status at some point after you expect your tasks to be complete. In this example I’ve created an email notification task to run 2 hours after my updates/reboots.
    2015-02-17 15_28_00-new 1 - BatchPatch X4
  6. The email notification that we created in the previous step will be sent according to the settings defined in ‘Tools > Settings > Email notifications.’ However, I want to make one adjustment in my email notification task, so that the notification sends me an entire grid report instead of just a single row report. Select ‘Actions > Email notifications > Override default email notification.’ Then type “$grid” in the ‘Body’ field. This tells BatchPatch to email me a whole grid report when this task is executed.
    2015-02-17 15_30_44-new 1 - BatchPatch X4
  7. The final grid, ready to run tasks tonight, looks like the screen below.
    2015-02-17 15_33_08-new 1 - BatchPatch X4
This entry was posted in Blog, General, Tutorials and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.