Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell Scheduled Task "Delay task for" option

Tags:

powershell

I need to create Task Schedule with "Delay task for" option for 1 min. I can see PowerShell cmdlet New-ScheduledTaskTrigger has an option -RandomDelay, but I don't think it's valid. I can't see another option in Documentation either (https://technet.microsoft.com/en-us/library/jj649816(v=wps.630).aspx).

$DELAY = new-timespan -minutes 1
$T = New-ScheduledTaskTrigger -AtLogon -RandomDelay $DELAY
like image 935
ferrean Avatar asked Jan 06 '23 03:01

ferrean


1 Answers

Just add this part:

$T.Delay = 'PT1M'
like image 134
Nikola Sajic Avatar answered Jan 14 '23 23:01

Nikola Sajic