@@ -14,55 +14,65 @@ Plan to implement: Yes
14
14
The biggest factor preventing existing Windows PowerShell users from moving to PowerShell Core 6 has been cmdlet coverage.
15
15
Specifically being able to use existing cmdlets that ship with Windows.
16
16
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.
18
19
19
20
## Motivation
20
21
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.
24
25
25
26
## Specification
26
27
27
28
The module manifest (since Windows PowerShell 5) may contain a ` CompatiblePSEditions ` property to indicate if it is compatible with
28
29
Windows PowerShell (value of ` Desktop ` even on Windows Server) or PowerShell Core (value of ` Core ` ).
29
30
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 .
31
32
32
- ### Windows PSModulePath
33
+ ### Windows PowerShell 5.1 PSModulePath
33
34
34
- Windows PowerShell, by default, has module paths in:
35
+ Windows PowerShell, by default, searches for modules from these paths in this order :
35
36
36
37
1 . User profile: $env: UserProfile \Documents\WindowsPowerShell\Modules
37
38
2 . Program files: $env: ProgramFiles \WindowsPowerShell\Modules
38
39
3 . System32: $env: Windir \System32\WindowsPowerShell\v1.0\Modules
39
40
40
- The proposed change is to add * only * the ` System32 ` path to ` PSModulePath ` on PowerShell Core 6.
41
+ ### Proposed PowerShell Core PSModulePath Change
41
42
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:
45
44
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
48
48
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 ` .
50
51
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
52
60
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
55
64
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.
57
67
58
68
If the module manifest contains ` CompatiblePSEditions ` with value ` Core ` , then that module is treated as compatible.
59
69
If the module manifest contains ` CompatiblePSEditions ` with only the value of ` Desktop ` , then that module is treated as incompatible.
60
70
If the module manifest does not contain ` CompatiblePSEditions ` , then that module is treated the same as ` Desktop ` which is incompatible.
61
71
62
72
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.
64
74
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 ` ).
66
76
67
77
### Using Modules not declared as Compatible
68
78
@@ -79,3 +89,5 @@ Since module auto-discovery does not expose cmdlets from modules not declared as
79
89
## Alternate Proposals and Considerations
80
90
81
91
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