1

I would like to schedule a task in Windows Server 2019 to run on the Saturday before the first Monday in each month. I fail to see any way to configure such a trigger.

Asking here just to make sure I haven't missed anything...?

I have found various approximations that I can accept (with some drawbacks), so please don't bother suggesting any approximations. I am only asking about an exact schedule as described. Time of day is not critical, but e.g. 11am would be good.

To clarify, here are a few examples:

For February 2021, the first Monday is on February 1. I would like the task to be triggered on Saturday January 30.

For June 2021, the first Monday is on June 7. I would like the task to be triggered on Saturday June 5.

1 Answer 1

2

Schedule your job to run each saturday. Start it with some powershell that checks if the month 5 days earlier differs from the month two days later. If not, exit. See devblogs for the necessary functions.

if ( [DateTime]::Now.AddDays(-5).month -eq [DateTime]::Now.AddDays(2).month ) {
  echo "This is not the right time";
  exit;
}
7
  • Can you improve your answer by providing the PowerShell the user would want to have executed? Feb 2, 2021 at 8:22
  • Good idea! Solves the problem, albeit not using only the scheduler. I take it as a kind of confirmation that it cannot be done only using the trigger settings. Feb 2, 2021 at 8:36
  • Don't take it as a confirmation, only a possible solution. My knowledge of Windows is very limited, intentionally. Feb 2, 2021 at 11:23
  • @spikey_richie Of course, but then I get lambasted by this community. Feb 2, 2021 at 11:24
  • @GerardH.Pille how do you mean? Feb 2, 2021 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .