FIX: Cannot find built-in module that is compatible with the edition

Microsoft.PowerShell.Utility & Microsoft.PowerShell.Management

Cannot find the built-in module that is compatible with the edition. Please make sure the PowerShell built-in modules are available. They usually come with the PowerShell package under the $PSHOME module path, and are required for PowerShell to function properly.

If you made this error, you screwed up big time.
But luckily, it’s easy to solve!

I made the same mistake, but for clarity, I’ll write the steps to fix it before I tell you my story.

Microsoft.PowerShell.Utility and Microsoft.PowerShell.Management are PowerShell built-in modules. PowerShell needs those modules to function.
You should not replace these with other versions unless it’s done by upgrading your PowerShell edition.

There could be other built-in modules as well.
Luckily the fix below should help you with these as well.


Let’s first determine the PowerShell version

You probably already know which PowerShell version it is, but you can check this with the following command.

  • Version number 7 plus is the PowerShell core version
  • Version number 5 plus and lower is the PowerShell built-in version

An example of 7:

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

An example of 5:

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Let’s fix Cannot find built-in module that is compatible with the edition for version 7!

For PowerShell 7 aka the Core edition it is easy. You can basically run the installer again and then fix the version.
After the repairs, the modules are back in place.

To download the latest version you can click below.
The installer comes from the official repository on Microsoft’s Github.

https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/PowerShell-7.4.1-win-x64.msi

This is the official page:
PowerShell/PowerShell: PowerShell for every system! (github.com)


Let’s add them again under the $PSHOME module path, and are required for PowerShell to function properly for version 5!

PowerShell +- 5 is built into the Windows version.
Fortunately, you can turn this on or off under Windows features.

Basically, you uncheck PowerShell, restart the device, check it again, and restart again.
The modules should then be reinstalled, and your version will work properly again.

Go to Start and search for Windows Features.

FIX: Cannot find built-in module that is compatible with the edition
FIX: Cannot find built-in module that is compatible with the edition

Search for Windows PowerShell 2.0 in the list and uncheck this.

FIX: They usually come with the PowerShell package under the $PSHOME module path, and are required for PowerShell to function properly.
FIX: They usually come with the PowerShell package under the $PSHOME module path, and are required for PowerShell to function properly.

Restart your device.

Do the steps again and enable Windows PowerShell again.


Something with a self-hosted agent, too quick, and 5 & 7

I’m going to keep this short because I’m not proud of it….
We have a repo that makes a copy of a module folder in the repo to a self-hosted agent modules directory on Azure DevOps.

I wanted to quickly add some modules, so I copied a number of modules from my own module directory, including the 2 above.

Since I copied it from the module’s directory of PowerShell 5, and the pipeline put them into the module’s directory of PowerShell 7 on our self-hosted agent we ran into problems! Oh dear!

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell DevOps Engineer. In my spare time I write about interesting stuff that I encounter during my work.

Leave a Reply

Your email address will not be published. Required fields are marked *