Skip to content

Commit a418431

Browse files
committed
address feedback for CompatiblePSEditions RFC
2 parents 3c3b7ec + f59e1d9 commit a418431

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

2-Draft-Accepted/RFCNNNN-PSCore6-and-Windows-Modules.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,65 @@ Plan to implement: Yes
1414
The biggest factor preventing existing Windows PowerShell users from moving to PowerShell Core 6 has been cmdlet coverage.
1515
Specifically being able to use existing cmdlets that ship with Windows.
1616
The PowerShell team has been working with Windows teams to port their modules so that they work in PowerShell Core 6.
17-
This RFC addresses the experience for the user when using PowerShell Core 6.1 with next version of Windows 10.
17+
This RFC addresses the experience for the user when using PowerShell Core 6.1 with next version of Windows 10 specifically
18+
focused on the Windows PowerShell modules that are shipped within Windows.
1819

1920
## Motivation
2021

21-
As a ITPro,
22-
I can use existing Windows PowerShell modules in PowerShell Core 6,
23-
so that I can start deploying PowerShell Core 6 in my enterprise.
22+
As an ITPro,
23+
I can use existing Windows PowerShell modules in PowerShell Core 6,
24+
so that I can deploy PowerShell Core 6 in my enterprise.
2425

2526
## Specification
2627

2728
The module manifest (since Windows PowerShell 5) may contain a `CompatiblePSEditions` property to indicate if it is compatible with
2829
Windows PowerShell (value of `Desktop` even on Windows Server) or PowerShell Core (value of `Core`).
2930
Currently, this property is only documentation and not observed by PowerShell.
30-
The proposal is to modify PowerShell Core 6.1 to respect this property.
31+
The proposal is to modify PowerShell Core 6.1 to respect this property for in-box Windows PowerShell modules.
3132

32-
### Windows PSModulePath
33+
### Windows PowerShell 5.1 PSModulePath
3334

34-
Windows PowerShell, by default, has module paths in:
35+
Windows PowerShell, by default, searches for modules from these paths in this order:
3536

3637
1. User profile: $env:UserProfile\Documents\WindowsPowerShell\Modules
3738
2. Program files: $env:ProgramFiles\WindowsPowerShell\Modules
3839
3. System32: $env:Windir\System32\WindowsPowerShell\v1.0\Modules
3940

40-
The proposed change is to add *only* the `System32` path to `PSModulePath` on PowerShell Core 6.
41+
### Proposed PowerShell Core PSModulePath Change
4142

42-
Modules in the user profile should be re-installed under PowerShell Core 6.
43-
Duplicate modules is something that can be addressed in PowerShellGet and outside the scope of this RFC.
44-
Modules in `Program Files` that may be compatible with PowerShell Core 6 is addressed below.
43+
PowerShell Core, by default, searches for modules form these paths in this order:
4544

46-
Users who want to search the entirety of the Windows PowerShell PSModulePath should use `Add-WindowsPSModulePath` cmdlet
47-
from the `WindowsCompatibility` module.
45+
1. User profile: $env:UserProfile\Documents\PowerShell\Modules
46+
2. Program files: $env:ProgramFiles\PowerShell\Modules
47+
3. PSHOME: value of $PSHOME
4848

49-
### PowerShell Core PSModulePath
49+
The proposed change is to add *only* the `System32` path from Windows PowerShell 5.1 to `PSModulePath` on PowerShell Core 6
50+
as the last path in `PSModulePath`.
5051

51-
Modules in the PowerShell Core PSModulePaths are implicitly deemed compatible even if the manifest does not
52+
This means that modules installed using Windows PowerShell with `-Scope CurrentUser` will not be available from PowerShell
53+
Core 6.
54+
To use those modules, the user needs to use `Install-Module -Scope CurrentUser` from within PowerShell Core 6.
55+
Duplicate modules are something that can be addressed in PowerShellGet and outside the scope of this RFC.
56+
57+
Modules in `Program Files` that may be compatible with PowerShell Core 6 is addressed below.
58+
59+
Modules in the PowerShell Core `PSModulePath` are implicitly deemed compatible even if the manifest does not
5260
declare compatibility.
53-
A user would have explicitly used `Install-Module` within PowerShell Core 6 for those modules to be in the
54-
PowerShell Core 6 module path with expectation those modules are available.
61+
A user who explicitly uses `Install-Module` within PowerShell Core 6 expect those modules to be available to PowerShell Core 6.
62+
63+
### CompatiblePSEditions for Windows System32
5564

56-
### CompatiblePSEditions
65+
When we add the `System32` path to PowerShell Core's `PSModulePath`,
66+
we will use additional logic to validate that the module is compatible with PowerShell Core.
5767

5868
If the module manifest contains `CompatiblePSEditions` with value `Core`, then that module is treated as compatible.
5969
If the module manifest contains `CompatiblePSEditions` with only the value of `Desktop`, then that module is treated as incompatible.
6070
If the module manifest does not contain `CompatiblePSEditions`, then that module is treated the same as `Desktop` which is incompatible.
6171

6272
By default, `Get-Module -ListAvailable` will only show modules found in `PSModulePath` that are declared as compatible.
63-
Similarly, module auto-discovery will only find modules that are declared as compatible.
73+
Similarly, module auto-discovery and auto-loading will only find modules that are declared as compatible.
6474

65-
The `ModuleInfo` table format will add a column for `CompatiblePSEditions` (between `Name` and `ExportedCommands`).
75+
The `ModuleInfo` table format will add a column for `PSEditions` (shortened from `CompatiblePSEditions` between `Name` and `ExportedCommands`).
6676

6777
### Using Modules not declared as Compatible
6878

@@ -79,3 +89,5 @@ Since module auto-discovery does not expose cmdlets from modules not declared as
7989
## Alternate Proposals and Considerations
8090

8191
Open issue: Should `CompatiblePSEditions` column only be added in `ModuleInfo` table format if used with `-SkipCompatibilityCheck`?
92+
Users who want to search the entirety of the Windows PowerShell `PSModulePath` should use `Add-WindowsPSModulePath` cmdlet
93+
from the `WindowsCompatibility` module.

0 commit comments

Comments
 (0)