Install-Package vs Install-Module

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Michael Maher Michael Maher 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #54233
    Profile photo of Michael Maher
    Michael Maher
    Participant

    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
    1.7.2.4    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.

    Michael

    #54284
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

    #54285
    Profile photo of Michael Maher
    Michael Maher
    Participant

    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.

    https://www.powershellgallery.com/GettingStarted?section=FAQ

    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

    Regards,

    Michael

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.