PowerShellGet – Package Management for PowerShell modules – Part 1


Often I hear and see quite some confusion about OneGet, PowerShellGet and PackageManagement.
I hope this blog post clarifies most of it…

 

PackageManagement module

“PackageManagement” (formerly referred to as OneGet) is a new way to discover and install (software) packages from the web.
It is a manager, multiplexor or aggregator of existing package managers (also called package providers) that allows unified Windows package management from a single Windows PowerShell interface.

With the PowerShell module “PackageManagement”, you can do the following:

  • Manage a list of software repositories in which packages can be searched, acquired and installed
  • Discover and install different package managers
  • Discover software packages
  • Seamlessly install, uninstall and inventory packages from one or more software repositories

    image
    An overview of the PackageManagement module cmdlets.

    PackageManagement is essentially a Package Management “aggregator” that creates a unified and consistent PowerShell interface for ITPro’s.
    It provides an extensible plug-in model that allows different installer technologies or package managers to plug-in to using package providers
      

    The PowerShell PackageManagement module provides three levels of management:

  • Package
  • Package Provider
  • Package Source

    image

    Each PackageManagement provider manages one or multiple package sources (repositories) where (software) packages are stored.

    image
    ‘Get-PackageProvider’ gets a list of locally installed Package Providers.

    image
    ‘Find-PackageProvider’ gets a list of online available Package Providers.

    Regardless of the technology underneath, users can use these common cmdlets to install/uninstall packages, add/remove/query package repositories (also called Package Sources).

    image
    ‘Get-PackageSource’ get the current list of Package Sources.

    PowerShellGet module 

    PowerShellGet is a package manager for Windows PowerShell modules and scripts.
    PowerShellGet is shipped as a PowerShell module that defines an extension for PackageManagement/OneGet (using a provider called PowerShellGet) and allows to manage PowerShell modules, scripts and DSC resources as software packages.

    image
    Manage PowerShell modules, script and DSC resources as “software” packages.

     

    PowerShellGet Repositories

    Each of the providers that plug into PackageManagment/OneGet provide access to one or more repositories. 
    These repositories may be public or private, accessible via the internet or only accessible on an internal network.  They may be created and supported by Microsoft or created by individuals and/or organizations.

    I will cover how to create additional repositories for PowerShellGet in a future blog post. 
    Essentially, all PowerShellGet repositories are NuGet galleries behind the scenes (NuGet is a package manager for the Microsoft development platform). So, NuGet is the key to the solution. 

    Internally the PowerShellGet provider is using PackageManagment to talk to the repository and PowerShell modules, scripts and DSC resources can be managed as “packages” through that provider.
    By default, the PowerShellGet provider connects PackageManagement to the PowerShell Gallery (a Microsoft-supported, public PowerShellGet repository).

    List all PowerShellGet repositories that have been registered for use by PowerShellGet on the local system by using Get-PSRepository.

    image
    ‘Get-PSRepository’ list the PSGallery as the default (and only) registered repository.

     

    Some new features in PowerShellGet:

  • Side-by-side version support on Windows PowerShell 5.0 or newer
  • Module dependency installation support
  • Three new cmdlets (Get-InstalledModule, Uninstall-Module, Save-Module)

     

    Related reading:

  • 2 thoughts on “PowerShellGet – Package Management for PowerShell modules – Part 1

    Leave a comment