From 3c3b7ec5671709ff697c7c7bc01088403f4ad62f Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 14 Jun 2018 12:25:14 -0700 Subject: [PATCH 1/7] draft of enabling discover of compatible Windows PowerShell modules in PowerShell Core 6 --- .../RFCNNNN-PSCore6-and-Windows-Modules.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md new file mode 100644 index 000000000..f708ef6a3 --- /dev/null +++ b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md @@ -0,0 +1,81 @@ +--- +RFC: RFCNNNN +Author: Steve Lee +Status: Draft +SupercededBy: n/a +Version: 0.1 +Area: Engine +Comments Due: 6/30 +Plan to implement: Yes +--- + +# Enable Discovery and Importing of Compatible in-box Windows PowerShell modules + +The biggest factor preventing existing Windows PowerShell users from moving to PowerShell Core 6 has been cmdlet coverage. +Specifically being able to use existing cmdlets that ship with Windows. +The PowerShell team has been working with Windows teams to port their modules so that they work in PowerShell Core 6. +This RFC addresses the experience for the user when using PowerShell Core 6.1 with next version of Windows 10. + +## Motivation + + As a ITPro, + I can use existing Windows PowerShell modules in PowerShell Core 6, + so that I can start deploying PowerShell Core 6 in my enterprise. + +## Specification + +The module manifest (since Windows PowerShell 5) may contain a `CompatiblePSEditions` property to indicate if it is compatible with +Windows PowerShell (value of `Desktop` even on Windows Server) or PowerShell Core (value of `Core`). +Currently, this property is only documentation and not observed by PowerShell. +The proposal is to modify PowerShell Core 6.1 to respect this property. + +### Windows PSModulePath + +Windows PowerShell, by default, has module paths in: + + 1. User profile: $env:UserProfile\Documents\WindowsPowerShell\Modules + 2. Program files: $env:ProgramFiles\WindowsPowerShell\Modules + 3. System32: $env:Windir\System32\WindowsPowerShell\v1.0\Modules + +The proposed change is to add *only* the `System32` path to `PSModulePath` on PowerShell Core 6. + +Modules in the user profile should be re-installed under PowerShell Core 6. +Duplicate modules is something that can be addressed in PowerShellGet and outside the scope of this RFC. +Modules in `Program Files` that may be compatible with PowerShell Core 6 is addressed below. + +Users who want to search the entirety of the Windows PowerShell PSModulePath should use `Add-WindowsPSModulePath` cmdlet +from the `WindowsCompatibility` module. + +### PowerShell Core PSModulePath + +Modules in the PowerShell Core PSModulePaths are implicitly deemed compatible even if the manifest does not +declare compatibility. +A user would have explicitly used `Install-Module` within PowerShell Core 6 for those modules to be in the +PowerShell Core 6 module path with expectation those modules are available. + +### CompatiblePSEditions + +If the module manifest contains `CompatiblePSEditions` with value `Core`, then that module is treated as compatible. +If the module manifest contains `CompatiblePSEditions` with only the value of `Desktop`, then that module is treated as incompatible. +If the module manifest does not contain `CompatiblePSEditions`, then that module is treated the same as `Desktop` which is incompatible. + +By default, `Get-Module -ListAvailable` will only show modules found in `PSModulePath` that are declared as compatible. +Similarly, module auto-discovery will only find modules that are declared as compatible. + +The `ModuleInfo` table format will add a column for `CompatiblePSEditions` (between `Name` and `ExportedCommands`). + +### Using Modules not declared as Compatible + +`Get-Module -ListAvailable` will support `-SkipCompatibilityCheck` switch to list all modules in `PSModulePath`. + +If `Import-Module` is used with a module that is not declared in the manifest as compatible, it will throw a terminating error: + +> The module '{0}' could not be imported as it is not declared as compatible. Use `-SkipCompatibilityCheck` switch to override this check. + +`Import-Module` will support `-SkipCompatibilityCheck` switch to try and import the module regardless of `CompatiblePSEditions`. +Since module auto-discovery does not expose cmdlets from modules not declared as compatible, explicit `Import-Module` with +`-SkipCompatibilityCheck` is required to use potentially incompatible modules. + +## Alternate Proposals and Considerations + +Open issue: Should `CompatiblePSEditions` column only be added in `ModuleInfo` table format if used with `-SkipCompatibilityCheck`? From 8f228a9f8208a303133ffd86152c8f575e5651d5 Mon Sep 17 00:00:00 2001 From: joeyaiello Date: Thu, 14 Jun 2018 17:13:02 -0700 Subject: [PATCH 2/7] feedback for CompatiblePSEditions RFC --- .../RFCNNNN-PSCore6-and-Windows-Modules.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md index f708ef6a3..9f56dd952 100644 --- a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md +++ b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md @@ -18,9 +18,9 @@ This RFC addresses the experience for the user when using PowerShell Core 6.1 wi ## Motivation - As a ITPro, - I can use existing Windows PowerShell modules in PowerShell Core 6, - so that I can start deploying PowerShell Core 6 in my enterprise. +As an ITPro, +I can use existing Windows PowerShell modules in PowerShell Core 6, +so that I can deploy PowerShell Core 6 in my enterprise. ## Specification @@ -40,27 +40,29 @@ Windows PowerShell, by default, has module paths in: The proposed change is to add *only* the `System32` path to `PSModulePath` on PowerShell Core 6. Modules in the user profile should be re-installed under PowerShell Core 6. -Duplicate modules is something that can be addressed in PowerShellGet and outside the scope of this RFC. +Duplicate modules are something that can be addressed in PowerShellGet and outside the scope of this RFC. Modules in `Program Files` that may be compatible with PowerShell Core 6 is addressed below. -Users who want to search the entirety of the Windows PowerShell PSModulePath should use `Add-WindowsPSModulePath` cmdlet +Users who want to search the entirety of the Windows PowerShell `PSModulePath` should use `Add-WindowsPSModulePath` cmdlet from the `WindowsCompatibility` module. ### PowerShell Core PSModulePath -Modules in the PowerShell Core PSModulePaths are implicitly deemed compatible even if the manifest does not +Modules in the PowerShell Core `PSModulePath` are implicitly deemed compatible even if the manifest does not declare compatibility. -A user would have explicitly used `Install-Module` within PowerShell Core 6 for those modules to be in the -PowerShell Core 6 module path with expectation those modules are available. +A user who explicitly uses `Install-Module` within PowerShell Core 6 for those modules expect them to be available to PowerShell Core 6. -### CompatiblePSEditions +### CompatiblePSEditions for system32 + +When we add the `system32` path to PowerShell Core's `PSModulePath`, +we will use additional logic to validate that the module is compatible with PowerShell Core. If the module manifest contains `CompatiblePSEditions` with value `Core`, then that module is treated as compatible. If the module manifest contains `CompatiblePSEditions` with only the value of `Desktop`, then that module is treated as incompatible. If the module manifest does not contain `CompatiblePSEditions`, then that module is treated the same as `Desktop` which is incompatible. By default, `Get-Module -ListAvailable` will only show modules found in `PSModulePath` that are declared as compatible. -Similarly, module auto-discovery will only find modules that are declared as compatible. +Similarly, module auto-discovery and auto-loading will only find modules that are declared as compatible. The `ModuleInfo` table format will add a column for `CompatiblePSEditions` (between `Name` and `ExportedCommands`). From f59e1d9962db244bc4194d8d5451df2ad2f720aa Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 14 Jun 2018 17:33:35 -0700 Subject: [PATCH 3/7] Update RFCNNNN-PSCore6-and-Windows-Modules.md --- 2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md index 9f56dd952..2d96401bc 100644 --- a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md +++ b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md @@ -27,7 +27,7 @@ so that I can deploy PowerShell Core 6 in my enterprise. The module manifest (since Windows PowerShell 5) may contain a `CompatiblePSEditions` property to indicate if it is compatible with Windows PowerShell (value of `Desktop` even on Windows Server) or PowerShell Core (value of `Core`). Currently, this property is only documentation and not observed by PowerShell. -The proposal is to modify PowerShell Core 6.1 to respect this property. +The proposal is to modify PowerShell Core 6.1 to respect this property for in-box Windows PowerShell modules. ### Windows PSModulePath @@ -50,11 +50,11 @@ from the `WindowsCompatibility` module. Modules in the PowerShell Core `PSModulePath` are implicitly deemed compatible even if the manifest does not declare compatibility. -A user who explicitly uses `Install-Module` within PowerShell Core 6 for those modules expect them to be available to PowerShell Core 6. +A user who explicitly uses `Install-Module` within PowerShell Core 6 expect those modules to be available to PowerShell Core 6. -### CompatiblePSEditions for system32 +### CompatiblePSEditions for Windows System32 -When we add the `system32` path to PowerShell Core's `PSModulePath`, +When we add the `System32` path to PowerShell Core's `PSModulePath`, we will use additional logic to validate that the module is compatible with PowerShell Core. If the module manifest contains `CompatiblePSEditions` with value `Core`, then that module is treated as compatible. From 72ecfdaff97c59cd5eac3c01d4762193bf6c2f9b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 20 Jun 2018 10:47:26 -0700 Subject: [PATCH 4/7] add clarity on applicability to only system32 --- 2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md index 9ae5e5d40..d7a4e571b 100644 --- a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md +++ b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md @@ -56,8 +56,8 @@ Duplicate modules are something that can be addressed in PowerShellGet and outsi Modules in `Program Files` that may be compatible with PowerShell Core 6 is addressed below. -Modules in the PowerShell Core `PSModulePath` are implicitly deemed compatible even if the manifest does not -declare compatibility. +Modules _not under_ Windows System32 path, for example in the PowerShell Core `PSModulePath`, are implicitly deemed compatible even +if the manifest does not declare compatibility. A user who explicitly uses `Install-Module` within PowerShell Core 6 expect those modules to be available to PowerShell Core 6. ### CompatiblePSEditions for Windows System32 @@ -74,7 +74,7 @@ Similarly, module auto-discovery and auto-loading will only find modules that ar The `ModuleInfo` table format will add a column for `PSEditions` (shortened from `CompatiblePSEditions` between `Name` and `ExportedCommands`). -### Using Modules not declared as Compatible +### Using Modules from System32 not declared as Compatible `Get-Module -ListAvailable` will support `-SkipCompatibilityCheck` switch to list all modules in `PSModulePath`. From 243009403404150887e6e20e8781c2033aa3eebf Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 27 Jun 2018 15:26:30 -0700 Subject: [PATCH 5/7] rename `-SkipCompatibilityCheck` to `-SkipEditionCheck` --- .../RFCNNNN-PSCore6-and-Windows-Modules.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md index d7a4e571b..62d7c4001 100644 --- a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md +++ b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md @@ -76,18 +76,18 @@ The `ModuleInfo` table format will add a column for `PSEditions` (shortened from ### Using Modules from System32 not declared as Compatible -`Get-Module -ListAvailable` will support `-SkipCompatibilityCheck` switch to list all modules in `PSModulePath`. +`Get-Module -ListAvailable` will support `-SkipEditionCheck` switch to list all modules in `PSModulePath`. If `Import-Module` is used with a module that is not declared in the manifest as compatible, it will throw a terminating error: -> The module '{0}' could not be imported as it is not declared as compatible. Use `-SkipCompatibilityCheck` switch to override this check. +> The module '{0}' could not be imported as it is not declared as compatible. Use `-SkipEditionCheck` switch to override this check. -`Import-Module` will support `-SkipCompatibilityCheck` switch to try and import the module regardless of `CompatiblePSEditions`. +`Import-Module` will support `-SkipEditionCheck` switch to try and import the module regardless of `CompatiblePSEditions`. Since module auto-discovery does not expose cmdlets from modules not declared as compatible, explicit `Import-Module` with -`-SkipCompatibilityCheck` is required to use potentially incompatible modules. +`-SkipEditionCheck` is required to use potentially incompatible modules. ## Alternate Proposals and Considerations -Open issue: Should `CompatiblePSEditions` column only be added in `ModuleInfo` table format if used with `-SkipCompatibilityCheck`? +Open issue: Should `CompatiblePSEditions` column only be added in `ModuleInfo` table format if used with `-SkipEditionCheck`? Users who want to search the entirety of the Windows PowerShell `PSModulePath` should use `Add-WindowsPSModulePath` cmdlet from the `WindowsCompatibility` module. From a6298eaf31be5e48f429dfed0c92be786e796d28 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 25 Jul 2018 16:59:38 -0700 Subject: [PATCH 6/7] Update RFCNNNN-PSCore6-and-Windows-Modules.md --- .../RFCNNNN-PSCore6-and-Windows-Modules.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md index 62d7c4001..45c394c0b 100644 --- a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md +++ b/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md @@ -91,3 +91,30 @@ Since module auto-discovery does not expose cmdlets from modules not declared as Open issue: Should `CompatiblePSEditions` column only be added in `ModuleInfo` table format if used with `-SkipEditionCheck`? Users who want to search the entirety of the Windows PowerShell `PSModulePath` should use `Add-WindowsPSModulePath` cmdlet from the `WindowsCompatibility` module. + +--------------- +## PowerShell Committee Decision + +### Voting Results + +Joey Aiello: Accept + +Bruce Payette: Accept + +Steve Lee: Accept + +Hemant Mahawar: Accept + +Dongbo Wang: Accept + +Kenneth Hansen: Accept + +Jim Truher: Absent + +### Majority Decision + +Commmittee agrees to accept this RFC as written. + +### Minority Decision + +N/A From 3fde0f1adf992543550783801c8e3031aeb1c78f Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 25 Jul 2018 17:00:23 -0700 Subject: [PATCH 7/7] Update and rename RFCNNNN-PSCore6-and-Windows-Modules.md to RFC0025-PSCore6-and-Windows-Modules.md --- ...ws-Modules.md => RFC0025-PSCore6-and-Windows-Modules.md} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename 2-Draft-Accepted/{RFCNNNN-PSCore6-and-Windows-Modules.md => RFC0025-PSCore6-and-Windows-Modules.md} (99%) diff --git a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md b/2-Draft-Accepted/RFC0025-PSCore6-and-Windows-Modules.md similarity index 99% rename from 2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md rename to 2-Draft-Accepted/RFC0025-PSCore6-and-Windows-Modules.md index 45c394c0b..ab0576675 100644 --- a/2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md +++ b/2-Draft-Accepted/RFC0025-PSCore6-and-Windows-Modules.md @@ -1,9 +1,9 @@ --- -RFC: RFCNNNN +RFC: RFC0025 Author: Steve Lee -Status: Draft +Status: Draft-Accepted SupercededBy: n/a -Version: 0.1 +Version: 1.0 Area: Engine Comments Due: 6/30 Plan to implement: Yes