Skip to content

feat: let admins choose the PowerShell engine for script tasks - #487

Open
mirbach wants to merge 1 commit into
open-uem:mainfrom
mirbach:feat/powershell-7-engine
Open

feat: let admins choose the PowerShell engine for script tasks#487
mirbach wants to merge 1 commit into
open-uem:mainfrom
mirbach:feat/powershell-7-engine

Conversation

@mirbach

@mirbach mirbach commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • Adds an engine dropdown to the PowerShell task form: Windows PowerShell 5.1 (default), PowerShell 7+ (pwsh), and Auto (use pwsh if available, otherwise fall back to 5.1).
  • Reuses the existing script_executable column already used by unix_script tasks — no schema migration needed.
  • Validated in validatePowerShellScript, persisted in AddTaskToProfile/UpdateProfileTask, and threaded through to wingetcfg.ExecutePowershellScript for both the ad-hoc "run task now" and scheduled profile-application flows.
  • Locale strings added for all supported languages.

Depends on

Test plan

Verified end-to-end on a real Hyper-V lab (see openuem-agent#208 for full setup): logged into this console build, admitted a real Windows agent, created PowerShell tasks selecting each engine option from the new dropdown, and confirmed the agent executed each one under the correct PowerShell version — including the auto-detect and explicit-failure-when-missing cases.

  • go build ./... and templ generate pass
  • Dropdown renders with 5.1 selected by default for new tasks, correctly reflects ScriptExecutable when editing existing tasks
  • Task creation/update persists the selected engine
  • Existing tasks (ScriptExecutable == "") continue to run unchanged under PowerShell 5.1

Adds a dropdown to the PowerShell task form (Windows PowerShell 5.1 /
PowerShell 7+ (pwsh) / Auto) reusing the existing script_executable
column already used by unix_script tasks. The choice is validated,
persisted, and threaded through to wingetcfg.ExecutePowershellScript
for both the ad-hoc "run task now" and scheduled profile-application
flows.

Depends on open-uem/wingetcfg#feat/powershell-7-engine landing and a
new wingetcfg version being pinned in go.mod before this builds.
@mirbach

mirbach commented Aug 9, 2026

Copy link
Copy Markdown
Author

powershell (default/5.1) → runs under Windows PowerShell 5.1 ✅
auto, no PS7 installed → falls back to 5.1 ✅
auto, PS7 installed via MSIX/winget → correctly detects and uses pwsh 7.6.4 ✅
pwsh explicit, not installed → clean failure with a clear error message ✅

image image

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