foam_sync.ps1 (LIFEBALANCE) 2025-06-19T00:03:26Z

This commit is contained in:
Ben Miller
2025-06-19 00:03:26 -06:00
parent 642cf06a79
commit 005fa587c4

View File

@ -53,7 +53,7 @@ $taskPrincipal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Int
$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 configuration: run this script # Action configuration: run this script
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$scriptPath`"" $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$scriptPath`""
# Task settings # Task settings
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 1) $settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 1)
@ -77,7 +77,7 @@ try {
$actionMatches = $false $actionMatches = $false
if ($currentAction -is [Microsoft.Management.Infrastructure.CimInstance] ` if ($currentAction -is [Microsoft.Management.Infrastructure.CimInstance] `
-and $currentAction.Execute -eq "powershell.exe" ` -and $currentAction.Execute -eq "powershell.exe" `
-and $currentAction.Argument -eq ("-NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$scriptPath`"")) { -and $currentAction.Argument -eq ("-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$scriptPath`"")) {
$actionMatches = $true $actionMatches = $true
} }