Several ways this could be accomplished but i went for a Site Workflow scheduled to run on the first day of the year.
I have my Patching Calendar, default, ootb calendar ready and raring to go.
I have my Patching Schedule list, one additional column to hold the number of days after the 2nd tuesday each server needs patching:
Site Workflow:
Starting with a bit of configuration data:
Calculate date to get current date (01/01/2017)
Set a variable with my months (to add to starting month later) 0;1;2;3;4;5;6;7;8;9;10;11 where 0 will be Jan + 0 = Jan, Jan + 1 = Feb etc etc.
Regular Expression to split by ; the text variable into a collection.
Now i want to do a foreach on each month in my collection
Calculated Date to know the 1st date of each month
- 01/01/2017 +months 0
- 01/01/2017 +months 1
- etc, etc
Build String to get the friendly day, fn-FormatDate({VARIABLE},dddd)
Switch to evaluate the starting day of the month and add the necessary number of days to it to get to the 2nd tuesday.
Foreach part 1:
Foreeach part 2:
Now i query my Patching Schedule list for all items and return the Title column (Server name) in one collection and the days after patching tuesday in a separate collection.
Foreach part 3:
Now i know all servers to patch and when they need patching.
Now i do a foreach on each server in the collection
Use a collection operation to get the number of days after patching tuesday the server needs patching using the index of the server collection
Calculate the date when the server needs patching: date of 2nd tuesday + number of days after patching tuesday
Create the item in the Patching Calendar with Server name for the Title and the date calculated in the previous step as the start and end date
All items created