Install-Package vs Install-Module

Welcome Forums General PowerShell Q&A Install-Package vs Install-Module

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 2 months ago.

  • Author
    Posts
  • #54233

    Participant
    Points: 21
    Rank: Member

    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

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    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

    Participant
    Points: 21
    Rank: Member

    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

The topic ‘Install-Package vs Install-Module’ is closed to new replies.