diff --git a/foam_sync.ps1 b/foam_sync.ps1 index 017adf9..e502ce1 100644 --- a/foam_sync.ps1 +++ b/foam_sync.ps1 @@ -53,7 +53,7 @@ $taskPrincipal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Int $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes $frequencyMinutes) # 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 $settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 1) @@ -77,7 +77,7 @@ try { $actionMatches = $false if ($currentAction -is [Microsoft.Management.Infrastructure.CimInstance] ` -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 }