foam_sync.ps1 (LIFEBALANCE) 2025-06-19T18:57:22Z
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
#Requires -Version 5.1
|
||||
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
Set-StrictMode -Version 3.0
|
||||
|
||||
$scriptPath = $MyInvocation.MyCommand.Path
|
||||
@ -32,9 +36,20 @@ try {
|
||||
$repetitionInterval = New-TimeSpan -Minutes $frequencyMinutes
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval $repetitionInterval
|
||||
$action = New-ScheduledTaskAction -Execute $taskExecute -Argument $taskArguments
|
||||
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit $(New-TimeSpan -Seconds $timeLimitSeconds)
|
||||
Write-Verbose "Task name: $taskName"
|
||||
Write-Verbose "Description: $taskDescription"
|
||||
Write-Verbose "Execute: $taskExecute"
|
||||
Write-Verbose "Arguments: $taskArguments"
|
||||
Write-Verbose "Frequency: $frequencyMinutes minutes"
|
||||
Write-Verbose "Time limit: $timeLimitSeconds seconds"
|
||||
Write-Verbose "Trigger: $trigger"
|
||||
Write-Verbose "Action: $action"
|
||||
Write-Verbose "Principal: $taskPrincipal"
|
||||
Write-Verbose "Settings: $settings"
|
||||
|
||||
|
||||
# Task settings
|
||||
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit $(New-TimeSpan -Seconds $timeLimitSeconds)
|
||||
|
||||
# Check and configure the scheduled task
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user