This content originally appeared on DEV Community and was authored by Nils Diekmann
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.
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 💪♥️❤♥️
Foto von Tim Marshall auf Unsplash
This content originally appeared on DEV Community and was authored by Nils Diekmann
Nils Diekmann | Sciencx (2024-07-02T21:26:27+00:00) Install Module in Powershell without Install-Module. Retrieved from https://www.scien.cx/2024/07/02/install-module-in-powershell-without-install-module/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.