# Install-module : The ‘install-module’ command was found in the module ‘PowerShellGet’, but the module could not be loaded.

I’ve been working last few hours trying to set up my laptop for PowerShell Conference, and one of the tasks is to get my modules up and running. To my surprise on Windows 10 1903 Install-Module thrown a weird error

blog

30 May 2019 pl

![Install-module : The ‘install-module’ command was found in the module ‘PowerShellGet’, but the module could not be loaded.](/wp-content/uploads/2019/05/img_5ceef56b663a0.png)

[Zobacz obrazy (2)](#pf-content-image-1-0)

I've been working last few hours trying to set up my laptop for PowerShell Conference, and one of the tasks is to get my modules up and running. To my surprise on Windows 10 1903 Install-Module thrown a weird error:

> PS C:\WINDOWS\system32> install-module install-module : The ‘install-module' command was found in the module ‘PowerShellGet', but the module could not be loaded. For more information, run ‘Import-Module PowerShellGet'. At line:1 char:1
> 
> - install-module
> - CategoryInfo : ObjectNotFound: (install-module:String) [], CommandNotFoundException
> - FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

[!\[install-module : The ‘install-module' command was found in the module ‘PowerShellGet', but the module could not be loaded.\](/wp-content/uploads/2019/05/img_5ceef4b3b97ab.png)](/wp-content/uploads/2019/05/img_5ceef4b3b97ab.png)

The usual fix, without even thinking, **Have you tried to turn it off and on again** didn't bring any results, so I had to try and fix this the old way by actually doing some simple verifications steps.

### 💡 What worked for me

It turns out I didn't have to look far and to make sure **Execution Policy** isn't blocking anything was the right shot.

```powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\WINDOWS\system32> install-module
install-module : The 'install-module' command was found in the module 'PowerShellGet', but the module could not be
loaded. For more information, run 'Import-Module PowerShellGet'.
At line:1 char:1
+ install-module
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (install-module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

PS C:\WINDOWS\system32> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
PS C:\WINDOWS\system32> Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
PS C:\WINDOWS\system32> install-module
cmdlet Install-Module at command pipeline position 1
Supply values for the following parameters:
Name[0]:
PS C:\WINDOWS\system32>
```

So a simple command setting execution policy to **unrestricted** fixed my error. While I was at it, I decided to trust **PSGallery** so I won't get prompted to confirm the installation of every module out there.

[!\[install-module : The ‘install-module' command was found in the module ‘PowerShellGet', but the module could not be loaded.\](/wp-content/uploads/2019/05/img_5ceef56b663a0.png)](/wp-content/uploads/2019/05/img_5ceef56b663a0.png)

Finally, I was able to install all my usual modules that are about to show up on my session.

## Powiązane projekty

Projekty powiązane z tagami, kategoriami i treścią tego wpisu.

[Wszystkie projekty](/projekty/)

Trwa dopasowywanie projektów...

[Powrót do bloga](/blog/)

## Powiązane wpisy

- [Check an API write after a PowerShell timeout](/blog/verify-uncertain-api-outcomes-powershell/)
- [Inspect and convert mixed Office archives with PSWriteOffice](/blog/inspect-and-convert-mixed-office-archives-pswriteoffice/)
- [Compose PDF reports and automate page workflows with PSWriteOffice](/blog/automate-pdf-reports-and-page-workflows-pswriteoffice/)

<!-- PowerForge markdown artifact sha256:E5040CF765D0D4FD907587503405CA84BB16CFBE17882EBFAA62F09B98995F06 -->
