Patching Windows computers is essential, but the inconsistent date of “Patch Tuesday,” the second Tuesday of the month, can make scheduling automation difficult. The PowerShell Script outlined in this video provides a function that will return the second Tuesday of the current month. Leverage this logic to generate automation that targets specific dates related to patch Tuesday.
The code can also find a specific instance of a day of the week. Passing the day and the instance into the function will return the date of that day/instance. For example, passing the second Friday into the function will return the date of the second Friday of that month.
Additional examples show how to evaluate if the current day is Patch Tuesday or what is five days from patch Tuesday.
The code used in this video can be found here: