I want to get the start date and the Due date for a task which will be repeated Annually using Powershell Please.

1 Answer 1


The solution is :

$today= Get-Date
$dueDate = (get-date).AddYears(1)

if ($today.DayOfWeek -eq "Monday" -and  $today.Day -le "7" -and  $today.Month -eq "1")
    foreach($item1 in $listSource1.Items | Where {$_["Frequency"] -eq "Annually"})
        $newItem = $listTarget.Items.Add();

        $newItem["StartDate"] = $today.ToShortDateString()
        $newItem["DueDate"] = $dueDate.ToShortDateString()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.