foam_sync.ps1 (LIFEBALANCE) 2025-06-19T14:27:09Z

This commit is contained in:
Ben Miller
2025-06-19 14:27:09 -06:00
parent 3f0ea6a0f2
commit 2cd6533e53

View File

@ -29,7 +29,7 @@ try {
# Run as the user who executes this script. # Run as the user who executes this script.
$taskPrincipal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive $taskPrincipal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes $frequencyMinutes) $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval $(New-TimeSpan -Minutes $frequencyMinutes)
$action = New-ScheduledTaskAction -Execute $taskExecute -Argument $taskArguments $action = New-ScheduledTaskAction -Execute $taskExecute -Argument $taskArguments
# Task settings # Task settings
@ -85,7 +85,6 @@ try {
catch { catch {
Write-Warning "Failed to update scheduled task '$taskName' in-place. Error: $($_.Exception.Message)" Write-Warning "Failed to update scheduled task '$taskName' in-place. Error: $($_.Exception.Message)"
Write-Warning "The task remains in its previous state. Manual intervention may be required or re-run with Administrator privileges." Write-Warning "The task remains in its previous state. Manual intervention may be required or re-run with Administrator privileges."
# We intentionally DO NOT unregister here to avoid the scenario you described.
} }
} }
} }