0 votes

Is there a way to have a Scheduled Task run a Powershell script on the 1st and 3rd Wednesday of every month?

Adaxes Version

2017.2
3.8.14823.0

by (1.3k points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello,

You can configure the Scheduled Task to run every Wednesday and use the below script in the If PowerShell script returns true condition. The script will return True only if the Wednesday is the first or the third of the month.

$day = (Get-Date).Day
$Context.ConditionIsMet = (($day -le 7) -or (($day -ge 15) -and ($day -le 21)))
0

When you say

The script will return True only if the Wednesday is the first or the third of the month.

do you mean the 1st or 3rd Wednesday of the month or if the date of the 1st or 3rd and the day is Wednesday

0

Hello,

The Scheduled Task will run on Wednesdays. The script condition will check if the Wednesday 1st or 3rd. So, we mean the 1st or 3rd Wednesday of the month.

Related questions

0 votes
0 answers

Hello! I've run into this problem before with the windows task scheduler. It looks like there's no way in the interface to target a specific day in the month aside from ... of the month and output $True so I can use it to trigger an email notification?

asked Nov 10, 2015 by drew.tittle (810 points)
0 votes
1 answer

Hello! how do i manage do get adaxes to remove all groups from the user after one month? We have a Business Rule where you can add an end of Date when the Account ... value field the powershell script works but not with the +1 Month. Thanks for your help!

asked Jun 14, 2023 by eww ag (140 points)
0 votes
1 answer

My scheduled task currently: Checks for staff in a particular OU that do not have an O365 license Adds a license Resets their AD Password Moves them to an OU based off ... scheduled task moves them out of the OU that the business rule is looking at. Thanks

asked Apr 15, 2020 by russmerriman (40 points)
0 votes
1 answer

I have a scheduled task that runs a Powershell script against an AD group, "Group 1". I need to get all of the members of Group 1, and add them to Group 2. The ... identity in the error message start with 'user;'? What is the correct way to accomplish this?

asked Aug 27, 2019 by ngb (220 points)
0 votes
1 answer

Using the powershell module, I know how to create a scheduled task, and also how to bind to a scheduled task that is already known. I also have used code to try creating ... same time as another. These are all one-time tasks and will be removed once executed.

asked Jan 19 by aweight (40 points)
3,346 questions
3,047 answers
7,772 comments
544,969 users