This is my schedule task running every Monday, after the update doesen't works. In the activity history there isn't log.
If I trying to exclude the script 'Fourth Sunday of the month' the schedule works.
If the Organizational Unit is '(Prod_Critical)' AND
script 'Fourth Sunday of the month' returns true
$FindNthDay='4'
$WeekDay='Sunday'
[datetime]$Today=[datetime]::NOW
$todayM=$Today.Month.ToString()
$todayY=$Today.Year.ToString()
[datetime]$StrtMonth=$todayM+'/1/'+$todayY
while ($StrtMonth.DayofWeek -ine $WeekDay ) { $StrtMonth=$StrtMonth.AddDays(1) }
#$StrtMonth.AddDays(7*($FindNthDay-1))
$datetopatch = '%datetime,+6d,00:00%'
$Context.ConditionIsMet = $StrtMonth.AddDays(7*($FindNthDay-1)) -eq $datetopatch
then
Execute custom command 'Windows_Servers_Patches_List (Reports)' for the organizational unit
Run PowerShell script 'Server Prod Critical ITDEV' for the organizational unit
Run PowerShell script 'Server Prod Critical SIAV\ITDEV' for the organizational unit
Run PowerShell script 'ServerBelron All Domain Controllers - WAVE 2' for the organizational unit
Run PowerShell script 'Remove File Patch' for the organizational unit