diff --git a/src/backdrop.psm1 b/src/backdrop.psm1 index 6561047..e04c3ed 100644 --- a/src/backdrop.psm1 +++ b/src/backdrop.psm1 @@ -353,7 +353,7 @@ function Set-Wallpaper { function Invoke-TimerConfig { $action = New-ScheduledTaskAction ` -Execute 'powershell.exe' ` - -Argument "-NonInteractive -WindowStyle Hidden -Command `"Import-Module backdrop; backdrop update`"" + -Argument "-NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command `"Import-Module backdrop; backdrop update`"" if ($script:RotateInterval -gt 0) { $timeTrigger = New-ScheduledTaskTrigger -Daily -At '00:00' diff --git a/src/install.ps1 b/src/install.ps1 index fb98902..e04ee0b 100644 --- a/src/install.ps1 +++ b/src/install.ps1 @@ -54,6 +54,9 @@ try { Write-Host "backdrop: installed to $destDir" # Load the module and enable the scheduled task. +# Process-scoped so it doesn't touch the system-wide execution policy; it only +# affects this powershell.exe instance and disappears when it exits. +Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force Import-Module (Join-Path $destDir 'backdrop.psm1') -Force backdrop enable