DEV Community

Cover image for Install Module in Powershell without Install-Module
Nils Diekmann
Nils Diekmann

Posted on • Originally published at Medium

Install Module in Powershell without Install-Module

The term ‘Install-Module’ is not recognized as the name of a cmdlet.

Have you ever found yourself in trouble because your Powershell is not working anymore after a colleague told you to just delete every module of Windows Powershell? No problem… you can just use Install-Module to reinstall everything. Oops… Install-Module is part of the module you just deleted. Here is the guide on how to escape this chicken and egg problem.

Chicken - Egg - Problem


How to restore Install-Module manually

To restore functionality, you need two modules. PowerShellGet and its dependency PackageManagement. You can get them from the Powershell Gallery. Search for the modules and click on ‘Manual Download’. There you will also find a helpful description of how to install these Nuget packages manually. Follow the instructions step by step. Only in step 5, you should first create a subfolder containing the version of the module. Restart your PowerShell and you can install all other modules now.

Are you a developer and too lazy to do things manually?

Since you already use Powershell, why not just use Powershell?

Finally, copy the two folders PowerShellGet and PackageManagement to your Powershell Module folder. You will get a warning that the files are marked as untrusted. If anyone finds a solution, please leave a comment.

If you are simply smart and pragmatic

Use the Windows Recycle Bin to restore the PowerShellGet and PackageManagement modules.


Please also leave a comment if anyone else is experiencing the same problem. Together we are strong 💪♥️❤♥️

Love for all
Foto von Tim Marshall auf Unsplash

Top comments (0)