Title: PSModulePath inherited when calling powershell.exe from pwsh.exe · Issue #8863 · PowerShell/PowerShell · GitHub
Open Graph Title: PSModulePath inherited when calling powershell.exe from pwsh.exe · Issue #8863 · PowerShell/PowerShell
X Title: PSModulePath inherited when calling powershell.exe from pwsh.exe · Issue #8863 · PowerShell/PowerShell
Description: This may be by design, but I wanted to make sure as it can lead to some unpredictable results when calling Windows PowerShell from PowerShell Core. When calling powershell.exe (to run some command which is not available in PowerShell Cor...
Open Graph Description: This may be by design, but I wanted to make sure as it can lead to some unpredictable results when calling Windows PowerShell from PowerShell Core. When calling powershell.exe (to run some command ...
X Description: This may be by design, but I wanted to make sure as it can lead to some unpredictable results when calling Windows PowerShell from PowerShell Core. When calling powershell.exe (to run some command ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8863
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PSModulePath inherited when calling powershell.exe from pwsh.exe","articleBody":"This may be by design, but I wanted to make sure as it can lead to some unpredictable results when calling Windows PowerShell from PowerShell Core.\r\n\r\nWhen calling powershell.exe (to run some command which is not available in PowerShell Core, such as Show-Command) - the PSModulePath environment variable seems to be inherited from pwsh.exe.\r\n\r\nOne example is calling Show-Command against a command which exists only in a PowerShell Core module (e.g. New-AzVm from C:\\Program Files\\PowerShell\\Modules\\Az.Compute):\r\npowershell.exe -noprofile 'Show-Command New-AzVm'\r\n\r\nThis should not have worked since Az.Compute is only installed in PowerShell Core, and not available in any of the PSModule paths for Windows PowerShell (on my machine).\r\n\r\nThis is a trivial example, but could have lead to more unpredictable results if a PowerShell Core-only module was called in a Windows PowerShell runspace.\r\n\r\n# Steps to reproduce\r\n\r\n```powershell\r\n# From pwsh.exe on Windows\r\npowershell.exe -noprofile '$env:psmodulepath'\r\n```\r\n\r\n# Expected behavior\r\n\r\n```none\r\nC:\\Users\\janring\\Documents\\WindowsPowerShell;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\r\n```\r\n\r\n# Actual behavior\r\n\r\n```none\r\nC:\\Users\\janring\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\6\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\r\n```\r\n\r\n# Environment data\r\n\r\n```none\r\nName Value\r\n---- -----\r\nPSVersion 6.1.2\r\nPSEdition Core\r\nGitCommitId 6.1.2\r\nOS Microsoft Windows 10.0.17763\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/janegilring","@type":"Person","name":"janegilring"},"datePublished":"2019-02-11T04:44:06Z","url":"https://github.com/PowerShell/PowerShell/issues/8863"}
| 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:0594cf27-1f20-cec3-341e-9605bcc62ced |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D808:3B68C7:242D560:32678E4:6AFD3C98 |
| html-safe-nonce | 394328afab3abe6a81da05673da16cf74dd21beaed893ba457458e7413047ce6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODA4OjNCNjhDNzoyNDJENTYwOjMyNjc4RTQ6NkFGRDNDOTgiLCJ2aXNpdG9yX2lkIjoiMjkyMTM2MDc1NzA4Nzg3ODI5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | af2c10540d65609e78eec2946227cb11cf793ec9ba28bccdbd5908edc12e840d |
| hovercard-subject-tag | issue:408632999 |
| 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/8863/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3fa69ec3397573890f65581ccf1178107aecc356623a743c412387adac50ad25/PowerShell/PowerShell/issues/8863 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3fa69ec3397573890f65581ccf1178107aecc356623a743c412387adac50ad25/PowerShell/PowerShell/issues/8863 |
| og:image:alt | This may be by design, but I wanted to make sure as it can lead to some unpredictable results when calling Windows PowerShell from PowerShell Core. When calling powershell.exe (to run some command ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | janegilring |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| 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 | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width