8

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?

  • "Is that a different one?" - No; In the example Install-Module is used to install the Azure Resource Manager. Install-Module itself is part of PowerShell 3.0 and Azure Resource Manager is part of PowerShell 5 – Ramhound Nov 5 '15 at 12:38
  • Thanks @Ramhound - I have psget installed which adds an Install-Module command, so I assume that's overwritten the Install-Module that comes with PS. – Rory Nov 5 '15 at 13:34
  • I would assume that, not guaranteed, but if the module itself is added its a safe bet. – Ramhound Nov 5 '15 at 13:38
  • blog post til.secretgeek.net/powershell/… – Tim Abell Feb 21 '17 at 17:10
18

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.

  • 1
    This is correct way to uninstall any module if it does not have references. PsGet by default does not have any, so should be fine just to remove it. – Mike Chaliy Feb 29 '16 at 14:30
  • 1
    You will probably need to restart your Powershell command window for this to take effect. – David White May 13 '16 at 1:56
  • 1
    Tn my computer, psget was installed under C:\Program Files\WindowsPowerShell\Modules – dinnouti Feb 16 '18 at 15:36
9

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/

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.