{{ message }}
Make some SystemPolicy APIs visible but non-op on Unix so that they can be included in PowerShellStandard.Library - #25051
Merged
Conversation
Dongbo Wang (daxian-dbw)
requested review from
Patrick Meinecke (SeeminglyScience) and
Travis Plunk (TravisEz13)
February 19, 2025 01:54
Member
Author
Collaborator
|
Perhaps we could annotate them with SupportedOSPlatformAttribute. |
Collaborator
|
How will this work across the Windows versions? The |
Member
Author
Travis Plunk (TravisEz13)
approved these changes
Mar 4, 2025
Travis Plunk (TravisEz13)
left a comment
Member
There was a problem hiding this comment.
Approved, but waiting on Patrick Meinecke (@SeeminglyScience) to verify one thing.
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Travis Plunk (TravisEz13)
approved these changes
Mar 4, 2025
Travis Plunk (TravisEz13)
left a comment
Member
There was a problem hiding this comment.
Reviewed with Patrick Meinecke (@SeeminglyScience)
SIRMARGIN
pushed a commit
to SIRMARGIN/PowerShell
that referenced
this pull request
Dec 12, 2025
…so that they can be included in `PowerShellStandard.Library` (PowerShell#25051)
Thatgfsj (Thatgfsj)
pushed a commit
to Thatgfsj-contribs/PowerShell
that referenced
this pull request
Aug 6, 2026
…so that they can be included in `PowerShellStandard.Library` (PowerShell#25051)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
Some
SystemPolicyAPIs are useful outside of PowerShell, for example, theThreadJobmodule depends on them to determine when to block a thread job from running. However, they are not included in thePowerShellStandard.Librarypackage because they are Windows-only API so far. So, it's hard for a module to use it -- it has to invoke those method with reflection.In order to include them in the
PowerShellStandard.Librarypackage, those APIs need to be available on both Windows and Unix platforms, so this PR make them visible but non-op on Unix, so that they can be included inPowerShellStandard.Librarythe next time we update that package.[Update] As pointed out in #25051 (comment), the
GetFilePolicyEnforcementmethod is not available in Windows 5.1 on Win10 or Windows Server 2022. So, we probably should only includeGetSystemLockdownPolicyandGetLockdownPolicyinPowerShellStandard.Libraryfor the short/middle term. After Windows 10 and Windows Server 2022 reach EOL (or when the method becomes available on them) we can then add theGetFilePolicyEnforcementmethod to the package.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed: