Skip to content

ci: fix Windows runner setup on PowerShell 5.1 - #742

Merged
foxnne merged 1 commit into
mainfrom
ci/windows-runner-setup-fixes
Oct 22, 2026
Merged

foxnne merged 1 commit into
mainfrom
ci/windows-runner-setup-fixes

Conversation

@foxnne

@foxnne foxnne commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #740. The first real run on Windows PowerShell 5.1 failed: New-LocalUser has no -UserCannotChangePassword (it is -UserMayNotChangePassword).

  • Fixes that parameter.
  • Audited the other cmdlet parameters in runner-setup.ps1 and runner-clean.ps1 against Windows PowerShell 5.1 from memory of its docs (New/Set/Get-LocalUser, the ScheduledTask cmdlets incl. -LogonType S4U, Invoke-WebRequest/RestMethod, Get-FileHash, Set-ItemProperty, Add-MpPreference, services, Get-Content/Set-Content): no other mismatch found.
  • test-runner-setup.ps1 now parses both scripts and fails on pwsh-7-only syntax and on any named parameter outside a 5.1 allowlist for the cmdlets listed there (a table to extend when a script uses a new cmdlet).

Verified: nothing was run (no pwsh here); CI runs the new test under pwsh 7. The allowlist is hand-written, so it only catches what it lists.

Second fix: the batch-logon grant now uses LsaAddAccountRights and verifies with LsaEnumerateAccountRights through a small Add-Type (no INF/secedit parsing, which failed on the first real run). Unrun here; the C# compiles only on the box.

@foxnne
foxnne force-pushed the ci/windows-runner-setup-fixes branch 6 times, most recently from e2c0b5b to 1068b67 Compare October 22, 2026 05:55
@foxnne
foxnne force-pushed the ci/windows-runner-setup-fixes branch from 1068b67 to dba535d Compare October 22, 2026 05:59
@foxnne
foxnne marked this pull request as ready for review October 22, 2026 08:07
@foxnne
foxnne added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 6e41421 Oct 22, 2026
11 checks passed
@foxnne
foxnne deleted the ci/windows-runner-setup-fixes branch October 22, 2026 08:19
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