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:
https://github.com/tsrob50/Get-PatchTuesday
3 thoughts on “Find Patch Tuesday with PowerShell”
Hi
thanks for the script, how can i use this script with Azure Update management to create recurring schedule that will execute the deployment schedule after the checking the Patch Tuesday
I mean the deployment schedule should not execute if the Tuesday is not Patch Tuesday.
Can i do that if yes then how?
Hi Travis,
I would be interested to hear about the solution Suraj requesting as well.
Many thanks in advance and keep up the good work! 🙂
You could do a schedule that runs every week, but put the logic into the PowerShell to execute the updates only when watch Tuesday is true