Skip to content

Import-Module works on System32 psm1/dll modules without -SkipEditionCheck #7296

Closed

Description

@rjmholt

Steps to reproduce

Import-Module C:\Windows\System32\WindowsPowerShell\v1.0\Modules\BitLocker\BitLocker.psm1

Expected 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 RootModule is specified make the nested load call with the parent module set to null
  • This behaviour should be true of all the following module types:
    • Script modules (.psm1)
    • Binary modules (.dll)
    • CDXML modules (.cdxml)
    • Script files (.ps1)

Activity

  1. added
    Issue-Bug
    on Jul 16, 2018
  2. daxian-dbw commented on Jul 17, 2018

    @daxian-dbw
    Member

    The related discussion from #7183 : #7183 (comment)

  3. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  4. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  5. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  6. added
    Resolution-No Activity
    on Nov 16, 2023
  7. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

  8. added
    WG-Cmdlets
    and removed on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugResolution-No ActivityWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions