The ‘Install-SitecoreConfiguration’ command was found in the module ‘SitecoreInstallFramework’, but the module could not be loaded. For more information, run ‘Import-Module SitecoreInstallFramework’.

Today, I started trying to install Sitecore 9.1 on my local.  While following the Quick installation guide, I got to the step where you run the prerequisites installation:

Install-SitecoreConfiguration -Path .\Prerequisites.json

And got the following error:

Install-SitecoreConfiguration : The 'Install-SitecoreConfiguration' command was found in the module 'SitecoreInstallFramework', but the module could not be loaded. For more information, run
'Import-Module SitecoreInstallFramework'.
At line:1 char:1
+ Install-SitecoreConfiguration -Path .\Prerequisites.json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-SitecoreConfiguration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

So, following the suggestion in the error message, I ran:

powershell -ExecutionPolicy ByPass Import-Module SitecoreInstallFramework

The reason I’m using the -ExecutionPolicy ByPass flag is because I usually get permission errors trying to run these scripts on my local.

After running the script above, I got the following warning:

WARNING: The script 'Invoke-RemoveSqlDatabaseTask.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: SqlServer.

Given that it was just a warning, I thought, “maybe I can just try to run the Install-SitecoreConfiguration -Path .\Prerequisites.json script again and it will work”.  So I tried it but got the same error.

At this point, I thought, “maybe I need to resolve that warning by manually installing the Powershell SqlServer module”.  So I tried installing this module – https://www.powershellgallery.com/packages/Sqlserver/21.1.18068 – but got a bunch of errors because I already had everything installed.

So then I thought, “maybe it’s a permissions issue with prerequisites script as well.”  So I tried running it with the execution policy bypass like so:

powershell -ExecutionPolicy ByPass Install-SitecoreConfiguration -Path .\Prerequisites.json

And this worked!  So, turns out, for me, it was the execution policies on my machine that were causing the errors to begin with.

Once I ran the script disabling execution policies, after about 8 minutes, all of my prerequisites were installed and I got a message saying:

Sitecore prerequisites are now installed, you must reboot your machine to allow prerequisite components installations to finish.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s