PowerShell Genie

PowerShell: module import failed

Error 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Inspect module prerequisites, manifest settings and dependencies when Import-Module cannot load a module.

What it means

PowerShell encountered a problem while importing a module. Inspect the detailed error for a missing dependency, unsupported edition or architecture, invalid manifest, or failing initialization code. Some module code may have run before the import failed.

Likely causes

  • A module or assembly named in the manifest RequiredModules or RequiredAssemblies list is missing
  • The module targets .NET Framework only and the session is PowerShell 7, or CompatiblePSEditions excludes Core
  • A conflicting version of a dependency assembly is already loaded into the process
  • The manifest has a syntax error or names a RootModule file that is not present
  • A copied DLL still carries its zone marker from the network share it came from

Check

1PS> $ModuleName = 'ActiveDirectory'
2PS> Import-Module $ModuleName -Verbose
3PS> Get-Module -ListAvailable $ModuleName
4PS> $PSVersionTable

Run these checks before changing anything.

What these checks establish

Read the actual import error and the last verbose loading message. A module appearing in ListAvailable means it is discoverable, not that dependencies or initialization will succeed.

Fix

Check the manifest and the exact missing dependency or assembly. Compare the required edition and architecture with this process. For an assembly-version conflict, test the intended module in a fresh session. Use Windows compatibility only for a supported module and workload. Unblock only a reviewed file whose zone marker is the established cause; do not recursively unblock an unknown directory.

Verify: Import in a clean session and confirm the required exported command resolves to the expected version.

Reference

Microsoft Learn: import-module

Continue
Genie guidePowerShell: module import failed

Inspect module prerequisites, manifest settings and dependencies when Import-Module cannot load a module.