Title: PowerShell Core cannot start a job using Windows PowerShell · Issue #7059 · PowerShell/PowerShell · GitHub
Open Graph Title: PowerShell Core cannot start a job using Windows PowerShell · Issue #7059 · PowerShell/PowerShell
X Title: PowerShell Core cannot start a job using Windows PowerShell · Issue #7059 · PowerShell/PowerShell
Description: When -PSVersion is specified, it should be respected. And all supported PSVersions (2.0 to 5.1) should be supported when the corresopnding version of Windows PowerShell is available. Note that, when -PSEdition 2.0 is specified, Start-Job...
Open Graph Description: When -PSVersion is specified, it should be respected. And all supported PSVersions (2.0 to 5.1) should be supported when the corresopnding version of Windows PowerShell is available. Note that, whe...
X Description: When -PSVersion is specified, it should be respected. And all supported PSVersions (2.0 to 5.1) should be supported when the corresopnding version of Windows PowerShell is available. Note that, whe...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/7059
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PowerShell Core cannot start a job using Windows PowerShell","articleBody":"When `-PSVersion` is specified, it should be respected. And all supported PSVersions (2.0 to 5.1) should be supported when the corresopnding version of Windows PowerShell is available.\r\n\r\nNote that, when `-PSEdition 2.0` is specified, `Start-Job` checks if PSv2 is installed using the method `RemotingCommandUtil.CheckIfPowerShellVersionIsInstalled` which will blindly throw exception in PSCore (see code below). If we want to support `-PSEdition 2.0`, then the `#if CORECLR` section of the method body should be removed.\r\n\r\n```c#\r\n internal static void CheckIfPowerShellVersionIsInstalled(Version version)\r\n {\r\n // Check if PowerShell 2.0 is installed\r\n if (version != null \u0026\u0026 version.Major == 2)\r\n {\r\n#if CORECLR\r\n // PowerShell 2.0 is not available for CoreCLR\r\n throw new ArgumentException(\r\n PSRemotingErrorInvariants.FormatResourceString(\r\n RemotingErrorIdStrings.PowerShellNotInstalled,\r\n version, \"PSVersion\"));\r\n#else\r\n // Because of app-compat issues, in Win8, we will have PS 2.0 installed by default but not .NET 2.0\r\n // In such a case, it is not enough if we check just PowerShell registry keys. We also need to check if .NET 2.0 is installed.\r\n ...\r\n```\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\nPS:1\u003e $job = Start-Job { $PSVersionTable.PSVersion } -PSVersion 5.1\r\nPS:2\u003e Receive-Job $job\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nPS:2\u003e Receive-Job $job\r\n\r\nMajor Minor Build Revision\r\n----- ----- ----- --------\r\n5 1 17134 81\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\nPS:2\u003e Receive-Job $job\r\n\r\nMajor Minor Patch PreReleas BuildLabel\r\n eLabel\r\n----- ----- ----- --------- ----------\r\n6 0 1\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable --\u003e\r\n\r\n```powershell\r\n\u003e $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 6.0.1\r\nPSEdition Core\r\nGitCommitId v6.0.1\r\nOS Microsoft Windows 10.0.17134\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/daxian-dbw","@type":"Person","name":"daxian-dbw"},"datePublished":"2018-06-13T20:24:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/7059/PowerShell/issues/7059"}
| 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:04ab1ecb-2b98-5c2a-b866-498e2d6b1c5a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A902:4DD3F:1543722:1C28169:6A534D02 |
| html-safe-nonce | 88492ff7301500218d2b330b91fe319b1fb45cd60563a1d0fc3d85c4854bf485 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTAyOjRERDNGOjE1NDM3MjI6MUMyODE2OTo2QTUzNEQwMiIsInZpc2l0b3JfaWQiOiIxMDY5NzEyODgwMTcyMjIzNzQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d769dab79a5f9c82f1385169a1aca314337f71f2b9bd5fe0286845e40e9a8a4b |
| hovercard-subject-tag | issue:332150182 |
| 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/7059/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6ab3132053c169bcc74e52515dd373498cc0a0e000c6eda9eafdf7d674c9f06b/PowerShell/PowerShell/issues/7059 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6ab3132053c169bcc74e52515dd373498cc0a0e000c6eda9eafdf7d674c9f06b/PowerShell/PowerShell/issues/7059 |
| og:image:alt | When -PSVersion is specified, it should be respected. And all supported PSVersions (2.0 to 5.1) should be supported when the corresopnding version of Windows PowerShell is available. Note that, whe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daxian-dbw |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width