-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Import-Module works on System32 psm1/dll modules without -SkipEditionCheck #7296
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
Description
Steps to reproduce
Import-Module C:\Windows\System32\WindowsPowerShell\v1.0\Modules\BitLocker\BitLocker.psm1Expected behavior
Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitLocker\BitLocker.psm1' does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module -SkipEditionCheck' to ignore the compatibility of this module.
At line:1 char:1
+ Import-Module BitLocker
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\syst...\BitLocker.psd1:String) [Import-Module], InvalidOperationException
+ FullyQualifiedErrorId : Modules_PSEditionNotSupported,Microsoft.PowerShell.Commands.ImportModuleCommand
Actual behavior
<imports without error>
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.3
PSEdition Core
GitCommitId v6.1.0-preview.3-138-gf8ccb9f84755023afa52815d8dacc924757e61b1
OS Microsoft Windows 10.0.17713
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Notes
- Directly importing a psm1 (or other non-psd1 module) from the System32 module path should only work with
-SkipEditionCheck - However, since they are nested modules, importing must succeed if they are imported as the nested module of an edition-compatible psd1 module
- Implementing this may be complicated in terms of remembering the compatibility state of the parent module, especially since modules where
RootModuleis specified make the nested load call with the parent module set tonull - This behaviour should be true of all the following module types:
- Script modules (
.psm1) - Binary modules (
.dll) - CDXML modules (
.cdxml) - Script files (
.ps1)
- Script modules (
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module