diff --git a/Setup-SMTPGraphRelay.ps1 b/Setup-SMTPGraphRelay.ps1 index 0246f5a..d06cead 100644 --- a/Setup-SMTPGraphRelay.ps1 +++ b/Setup-SMTPGraphRelay.ps1 @@ -409,9 +409,11 @@ function Ensure-ScheduledTask { $psExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" + $configPath = Join-Path $TargetPath $ConfigFileName + $action = New-ScheduledTaskAction ` -Execute $psExe ` - -Argument "-NoLogo -NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`"" ` + -Argument "-NoLogo -NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`" -ConfigPath `"$configPath`"" ` -WorkingDirectory $TargetPath $trigger = New-ScheduledTaskTrigger -AtStartup