What is Install-Module command in Powershell?
Various Microsoft articles refer to the Powershell command Install-Module, but I can't find any reference to what this actually is and it's not very amenable to googling. I have psget installed, so I have its version of Install-Module ... but I think that's not the Install-Module that everyone else is talking about.
Ah, I found this Install-Module. Is that a different one to the one that PsGet installs? If so should I uninstall PsGet so I get back to the default one?
Solution 1:
I had previously installed PSGet which had overwritten my version of Install-Module
. You can check this by running help install-module
and see which version it refers to.
I couldn't find uninstall documentation for PSGet so I removed it by deleting the folder C:\Users\Rory\Documents\WindowsPowerShell\Modules\PSGet
. Now help install-module
refers to the microsoft version.
Solution 2:
You can work around the clash by prefixing the command with the module name:
PsGet installed and getting in the way:
C:\repos> install-module csproj
Module csproj was not found in central repository
At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PsGet\PsGet.psm1:694 char:13
+ throw "Module $Module was not found in central repository ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Module csproj w...tral repository:String) [], RuntimeException
+ FullyQualifiedErrorId : Module csproj was not found in central repository
using the qualified name:
C:\repos> powershellget\install-module csproj
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running
the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
C:\repos>
Thanks to http://windowsitpro.com/blog/dealing-cmdlet-name-conflicts
Module name obtained from reading the url of the documentation - https://msdn.microsoft.com/powershell/reference/5.1/PowerShellGet/install-module
More info: https://andrwwatt.wordpress.com/2006/05/13/coping-with-a-powershell-naming-clash/