Skip to content

Bypass execution policy and skip profile when launching PowerShell in ScriptBuildDriver - #107

Merged
Zaldaryon merged 1 commit into
mainfrom
fix/windows-installer-execution-policy
Sep 17, 2026
Merged

Zaldaryon merged 1 commit into
mainfrom
fix/windows-installer-execution-policy

Conversation

@Zaldaryon

Copy link
Copy Markdown
Collaborator

Root cause

Windows client installations configure the PowerShell execution policy to Restricted by default. When ScriptBuildDriver executes bootstrap.ps1 or package.ps1 during local source builds, it launches PowerShell with ["-File", scriptPath]. Without an explicit execution policy override, Windows PowerShell blocks script execution with SecurityError: UnauthorizedAccess.

Fix

Pass -NoProfile and -ExecutionPolicy Bypass to PowerShell invocations on Windows before -File, matching the convention already established in SdkInstaller.cs, UninstallRegistration.cs, and install-windows.cmd. Update the unit test assertions in BuildLayerTests.cs to verify the new argument sequence.

Verification

Ran the test suite locally:

  • Optimum.Bootstrap.Core.Tests: 154 passed, 0 failed
  • Optimum.Installer.Tests: 78 passed, 0 failed
  • Optimum.Cli.Tests: 24 passed, 0 failed

… ScriptBuildDriver

Windows client machines default to the Restricted PowerShell execution policy, which prevents ScriptBuildDriver from executing bootstrap.ps1 and package.ps1 during source builds.

Pass -NoProfile -ExecutionPolicy Bypass to PowerShell invocations on Windows, matching SdkInstaller and install-windows.cmd. Update the build layer command tests to assert the execution policy flags.
@Zaldaryon
Zaldaryon merged commit 631d666 into main Sep 17, 2026
6 checks passed
@Zaldaryon
Zaldaryon deleted the fix/windows-installer-execution-policy branch September 17, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant