Maintenance windows can be created in JAMS by utilizing a Resource definition (see: Using Resources).
First, create a new Resource. Call it "Maintenance_Window" and set the initial Quantity Available to "999999".
Once the Resource has been created, open the Properties of the root folder in JAMS, then navigate to the Elements Tab. Click Add, Expand the Prerequisite section, then select Resource Requirement and click Next. Add the Maintenance_Window resource and define Quantity Required to "1".
Setup of the maintenance window is now complete. When you are ready to "enable" your maintenance window, change the Quantity Available within the Properties of Maintenance_Window from "999999" to "0". This will allow Jobs to continue to enter the schedule, but they will not execute. When you are finished with your maintenance window, change the Quantity Available back to "999999" and your Jobs will be allowed to begin executing again.
Note: Jobs already executing when you set your resource to 0 will be allowed to finish executing. Keep this in mind so Jobs have enough time to complete prior to patching/taking down servers, etc. during the maintenance period.
Automating the Opening and Closing of a Maintenance Window
This process of opening and closing a maintenance window can also be automated. From the JAMS perspective, there are a few steps to take:
1. Create a Maintenance Window Resource setting the “QtyAvailable” to 999999
One difference in automating the opening and closing of the Maintenance Window from manually doing so, is that we will NOT be setting this resource requirement at the root folder (we will instead set this requirement on all lower folders, leaving only the root folder excluded from requiring this resource*).
NOTE: Excluding the root folder from this resource requirement is to ensure that the two jobs we are about to create in the root folder to manipulate the Maintenance Resource requirement are themselves not dependent on that resource.
2. Right-Click on the lower folder(s) and select “Properties”
3. Go the “Schedule tab” of the folder(s), click the plus icon and select “This Job depends on a…” and select “Resource…”.
4. Name the resource and set the “Quantity Required” to 1
5. Create a JAMS job (PowerShell) on the root folder that will set the Maintenance Window Resource to 0 and schedule it prior* to your scheduled maintenance.
NOTE: Ensure that all jobs currently executing after the Maintenance Window Resource has been set to 0 are allowed to finish before the a server reboot.
6. Now, create a JAMS job (PowerShell) on the root folder that will set the Maintenance Window Resource back to 99999999 and schedule it for after the maintenance or when it will complete.
NOTE: Also ensure that no other jobs are defined on the root folder besides the two jobs that change the Maintenance Window Resource.