Every other Wednesday RRS feed

  • Question

  • Hello ALL:

    My powershell script is schedule running everyday, but I want to execution a certain condition every other Wednesday starting either this Wednesday or next Wednesday. Thanks



    Tuesday, June 11, 2019 2:44 PM

All replies

  • There is no way to specify this with PowerShell CmdLets.  You can edit the XML to create a task XML that can do this.  Build a template task in task scheduler and save it then edit the XML as needed.


    Tuesday, June 11, 2019 3:37 PM
  • You can check the day of the week like this:

    Live long and prosper!


    Tuesday, June 11, 2019 7:03 PM
  • You can't do this with the task scheduler but you can test as BOfH has noted.

    To get the correct biweekly time use the week number.

    This Wednesday is week:

    [cultureinfo]::CurrentCulture.Calendar.GetWeekOfYear([datetime]::Today.AddDays(1), [System.Globalization.CalendarWeekRule]::FirstDay, 'Sunday')

    which is 24 and it is even.  Pick odd or even and test for Wednesday.  That will be true on every Wednesday on even weeks.  For next Wednesday then select odd weeks.


    Tuesday, June 11, 2019 7:53 PM
  • thank you all. It appeared the logic checking would be much easier in SQL script, the Powershell is still running everyday, but the condition is verified in SQL script and execute every other Wednesday.



    Wednesday, June 12, 2019 4:23 PM