Title: PowerShell startup exits 70 when user PSModulePath lookup is denied under MXC · Issue #28415 · PowerShell/PowerShell · GitHub
Open Graph Title: PowerShell startup exits 70 when user PSModulePath lookup is denied under MXC · Issue #28415 · PowerShell/PowerShell
X Title: PowerShell startup exits 70 when user PSModulePath lookup is denied under MXC · Issue #28415 · PowerShell/PowerShell
Description: Steps to reproduce On Windows, run PowerShell 7.6.9 under an MXC profile that permits reading the PowerShell runtime and the working directory but denies the process access to the user environment registry key. Start PowerShell without u...
Open Graph Description: Steps to reproduce On Windows, run PowerShell 7.6.9 under an MXC profile that permits reading the PowerShell runtime and the working directory but denies the process access to the user environment ...
X Description: Steps to reproduce On Windows, run PowerShell 7.6.9 under an MXC profile that permits reading the PowerShell runtime and the working directory but denies the process access to the user environment ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/28415
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PowerShell startup exits 70 when user PSModulePath lookup is denied under MXC","articleBody":"## Steps to reproduce\n\nOn Windows, run PowerShell 7.6.9 under an MXC profile that permits reading the PowerShell runtime and the working directory but denies the process access to the user environment registry key. Start PowerShell without user profiles and run a trivial command.\n\n```text\npwsh.exe -NoLogo -NoProfile -NonInteractive -Command \"Write-Output ready\"\n```\n\n## Expected behavior\n\nPowerShell starts using the available module paths. A direct read of the restricted user environment remains denied.\n\n## Actual behavior\n\nPowerShell exits with code 70 during startup. Process Monitor showed ACCESS DENIED on HKCU\\Environment. A managed startup trace identified the optional user-level PSModulePath lookup in ModuleIntrinsics.GetModulePath.\n\n## Proposed fix and verification\n\nCatch System.Security.SecurityException only around the user-level PSModulePath lookup in ModuleIntrinsics.GetModulePath, and continue with the existing process-level module path. Keep the rest of module discovery and access checks as they are.\n\nUnder the same narrow MXC profile the bundled 7.6.9 binary exited 70, while a separate source build with this change started and read an allowed file. The standalone regression check also confirmed that direct access to the user environment and a file outside the allowed roots remained denied.\n\nRelated downstream report: https://github.com/openai/codex/issues/60344. That report was from a separate machine.\r\n","author":{"url":"https://github.com/theFlexOne","@type":"Person","name":"theFlexOne"},"datePublished":"2026-11-14T01:23:45Z","url":"https://github.com/PowerShell/PowerShell/issues/28415"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5d9ca5e6-fd69-b380-0a44-3a2a3c7f83c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE2A:2C6631:2C3512:3A5ED8:6AFD16B9 |
| html-safe-nonce | cbbb3992c6f9d6aac3f5c92fe84d1836955062d8f68cbc790652b2eb96a4fbc0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTJBOjJDNjYzMToyQzM1MTI6M0E1RUQ4OjZBRkQxNkI5IiwidmlzaXRvcl9pZCI6IjczMjc0Nzg2OTcxNTIwMjYyOTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 75c9705550dc447154f96e8a66d14c175a54cc38f97561f993d6cd10686f63a6 |
| hovercard-subject-tag | issue:6383219396 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/28415/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1b1ff446d378c333b1164469a46b913568c480e638cf3343aee90f6150e925bb/PowerShell/PowerShell/issues/28415 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1b1ff446d378c333b1164469a46b913568c480e638cf3343aee90f6150e925bb/PowerShell/PowerShell/issues/28415 |
| og:image:alt | Steps to reproduce On Windows, run PowerShell 7.6.9 under an MXC profile that permits reading the PowerShell runtime and the working directory but denies the process access to the user environment ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | theFlexOne |
| hostname | github.com |
| expected-hostname | github.com |
| None | 065128366c233a9d57ff68ab6c96e25b99dd1b0ab70d23b70873d3dd6b5e4f19 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 941021edf0c2ec58298f4a2c8f27ae507d129c92 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width