September 18, 2016 at 9:31 am #54233
I am wondering when its appropriate to use Install-Package and Install-Module.
I have an internal PowerShell repository which I publish myown modules to. Install-Package will work with it, Install-Module doesn't.
Thus my understanding had been that Install-Package uses all registered providers. Install-Module seems to be just for online repositories such as PSGallery.
I can find and install Pester with both.
C:\> install-package pester WARNING: Version '3.4.0' of module 'Pester' is already installed at 'C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0' . . . C:\> install-module pester WARNING: Version '3.4.0' of module 'Pester' is already installed at 'C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0' . . .
But what is confusing me is PoshRSJobs was only available with Find-Module/Install-Module.
C:\> Find-Package poshrsjobs Find-Package : No match was found for the specified search criteria and package name 'poshrsjobs'. C:\> Find-Module poshrsjob 22.214.171.124 PoshRSJob PSGallery Module designed to . . .
I've searched around and looked at the help files to see what the use cases are for each but can't find an answer.
September 19, 2016 at 8:26 pm #54284
So... Install-Package is part of the lower-level PowerShell Package Manager. It does indeed use any available provider. Install-Module, on the other hand, is a very specific implementation that rides atop PowerShell Package Manager. It works only with providers that look and feel like PowerShell Gallery. That can be a private gallery.
PPM can potentially install any kind of software; Install-Module only installs PowerShell artifacts.
September 19, 2016 at 8:58 pm #54285
Thanks Don, that confirms my understanding.
I found this also.
At the PowerShell cmdlet layer, Install-Module is actually a thin wrapper around Install-Package -Provider PSModule.
My confusion over why Find-Package could not find the module was down to a typo.
C:\> Find-Package poshrsjobs
It should have been PoshRSJob not PoshRSJobs
You must be logged in to reply to this topic.