diff --git a/windows-installer/tasks-up.ps1 b/windows-installer/tasks-up.ps1 index 31562c646..8066219ef 100644 --- a/windows-installer/tasks-up.ps1 +++ b/windows-installer/tasks-up.ps1 @@ -10,9 +10,7 @@ $down = Join-Path (Get-ScriptDirectory) 'tasks-down.ps1' $taskName = "Certbot Renew & Auto-Update Task" $actionRenew = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -Command "certbot renew"' -$actionPreUpgrade = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-NoProfile -WindowStyle Hidden -Command ""Copy-Item '$InstallDir\auto-update.ps1' ""`$env:TMP\auto-update.ps1""""" $actionUpgrade = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-NoProfile -WindowStyle Hidden -File ""%TMP%\auto-update.ps1"" -InstallDir ""$InstallDir""" -$actionPostUpgrade = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -Command "Remove-Item "$env:TMP\auto-update.ps1" -ErrorAction "Ignore""' $delay = New-TimeSpan -Hours 12 $triggerAM = New-ScheduledTaskTrigger -Daily -At 12am -RandomDelay $delay @@ -23,4 +21,4 @@ $triggerPM = New-ScheduledTaskTrigger -Daily -At 12pm -RandomDelay $delay $adminSID = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544") $adminGroupID = $adminSID.Translate([System.Security.Principal.NTAccount]).Value $principal = New-ScheduledTaskPrincipal -GroupId $adminGroupID -RunLevel Highest -Register-ScheduledTask -Action $actionRenew,$actionPreUpgrade,$actionUpgrade,$actionPostUpgrade -Trigger $triggerAM,$triggerPM -TaskName $taskName -Description "Execute twice a day the 'certbot renew' command, to renew managed certificates if needed." -Principal $principal +Register-ScheduledTask -Action $actionRenew,$actionUpgrade -Trigger $triggerAM,$triggerPM -TaskName $taskName -Description "Execute twice a day the 'certbot renew' command, to renew managed certificates if needed." -Principal $principal