We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 729277e commit 76cefe9Copy full SHA for 76cefe9
scripts/build-agents/Initialize.ps1
@@ -1,8 +1,12 @@
1
# --- Settings ---
2
$TaskName = 'BuildAgent Daily Maintenance'
3
-$ScriptPath = "PSScriptRoot\Daily-Maintenance.ps1"
+$ScriptPath = "$PSScriptRoot\Daily-Maintenance.ps1"
4
$DailyAt = '03:00'
5
6
+# -- Delete the task if it exists
7
+Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
8
+
9
10
# --- Define action (run as SYSTEM) ---
11
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "-NoProfile -ExecutionPolicy Bypass -File $ScriptPath"
12
0 commit comments