$A = New-ScheduledTaskAction -execute “powershell” -argument “-nologo -noprofile -noninteractive C:\Server\Servidor.ps1”
$hourly = (New-TimeSpan -Minutes 5)
$duration = $dt.AddYears(30) -$dt;
$T = New-ScheduledTaskTrigger -Once -At (Get-Date).Date -RepetitionInterval $hourly -RepetitionDuration $duration
Register-ScheduledTask -TaskName monitora_email_2 -Trigger $T -Action $A -description “SCRIPT_VERIFICA_SERVIDOR” -User “NT AUTHORITY\SYSTEM” -RunLevel 1
Set-ScheduledTask monitora_email_2 -Trigger $T
Could you please explain what you want to do?
[quote quote=205140]Could you please explain what you want to do?
I need you to run this event every 5 minutes with no time to finish, every day. Not just for 30 years, but forever. If your computer turns off and on, the task should be working.
If you do not specify repetitionduration parameter, it will set to indefinitely.
[quote quote=205152]If you do not specify repetitionduration parameter, it will set to indefinitely.
It works. Thank you.