PowerShell - Install module from a specific repository

By xngo on March 11, 2020

When you are trying to install a module that exists in multiple repository, you will get the following error message:

PackageManagement\Install-Package : Unable to install, multiple modules matched 'DatastoreProxy'. Please specify a single -Repository.

From the full error message, it will list all the repositories that contain your module. Simply use the -Repository parameter to specify the repository name that you would like to install from.

Here is example to install DatastoreProxy module from powershell repository.

Install-Module -Force DatastoreProxy -Repository powershell

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.