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.2k points)

1 Answer

0 votes
by (215k 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

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 (90 points)
0 votes
1 answer

My scheduled task works like this (these are my action sets) Condition(s): Account is expired and home drive exists Action The user's home directory gets archived Condition(s): ... set? I do not want to split the scheduled task into two! Thanks in avance!

asked Apr 7 by lehnen (20 points)
0 votes
1 answer

Currently, when I disable a user account in Adaxes, the group memberships of the user remain intact. I'd like to automate the removal of group memberships such as distribution ... a list of groups/DL that the user was previously in and removed from. Thanks!

asked Nov 3, 2021 by jayden.ang (20 points)
2,740 questions
2,474 answers
6,475 comments
1,373,489 users