Discovering Packages using new Package Providers


With PowerShell, each “PackageManagement Provider” manages one or multiple package sources (repositories) where specific software packages are stored.
For example: NanoServer packages, Windows Container packages, Windows Server App (WSA) packages, …

These 5 basic steps are how to use package providers:

1. Discover package provider, using Find-PackageProvider

2. Install package provider, using Install-PackageProvider

3. Inventory package provider, using Get-PackageProvider

4. Load package provider, using Import-PackageProvider

5. Discover package using package provider, using Find-Package

Step 1 – Discovering Package Providers

The Find-PackageProvider cmdlet finds matching PackageManagement providers that are available in package sources registered with PowerShellGet.
These are package providers available for installation with the Install-PackageProvider cmdlet.
By default, this includes modules available in the PowerShell Gallery with the ‘PackageManagement’ and ‘Provider’ Tags.

image

Here’s a list of the current available package providers from the PS Gallery:

Package Provider Description

nuget

NuGet provider for the OneGet meta-package manager.

chocolatey

ChocolateyPrototype provider for the OneGet meta-package manager.

ContainerProvider

ContainerProvider is a Windows PowerShell module to find, save or install Windows Server Container images.

ContainerImage

This is a PackageManagement provider module which helps in discovering, downloading and installing Windows Container OS images.
For more details and examples refer to our project site at https://github.com/PowerShell/ContainerProvider.

GistProvider

Gist-as-a-Package – PackageManagement  PowerShell Provider to interop with Github Gists.

GitHubProvider

 

GitHub-as-a-Package – PackageManagement PowerShell Provider to interop with Github.

TSDProvider

PowerShell PackageManager provider to search & install TypeScript definition files from the community DefinitelyTyped repo.

NanoServerPackage

A PackageManagement provider to discover, save and install Nano Server optional packages (features and roles) on-demand.

For more details and examples refer to our project site at https://github.com/OneGet/NanoServerPackage.

MyAlbum

MyAlbum provider discovers the photos in your remote file repository and installs them to your local folder.

OfficeProvider

OfficeProvider allows users to install Microsoft Office365 ProPlus from Powershell.

GitLabProvider

GitLab PackageManagement provider.

WSAProvider

Provider to Discover, Install and Inventory Windows Server Apps (WSA).

 

Step 2 – Installing Package Providers

The cmdlet Install-PackageProvider installs one or more Package Management package providers.

image

image

Once the module is downloaded, it is installed on your system in the default path “C:\Program Files\WindowsPowerShell\Modules”.
A package provider actually consists of a PowerShell module.

image

 

Step 3 – Inventorying Package Providers

Package providers that are loaded and ready to be used on the local machine can be inventoried by using the cmdlet Get-PackageProvider.
By default, only currently loaded package providers show up.

# Get all currently loaded package providers
Get-PackageProvider

To view all package providers, including the those installed using the Install-PackageProvider use the parameter -ListAvailable.

# Following cmdlet will show all package providers available on the machine (including those that are not loaded)
Get-PackageProvider –ListAvailable

image
Loaded versus Available package providers.

 

Step 4 – Loading Package Providers

The cmdlet Import-PackageProvider adds/loads package providers to the current session.

Import-PackageProvider –Name <PackageProvider>

image

Some package providers will bring additional cmdlets to simplify the discovery and installation process, for example NanoServer and Windows Containers.

image
NanoServer Package Provider brings additional cmdlets.

image
Windows Container Package Provider brings additional cmdlets.

 

Step 5 – Discovering package using a Package Provider

#1 Find-Package using PackageProvider with parameter –ProviderName (from the PackageManagement module).

Find-Package –ProviderName <PackageProvider>

#2 Using the helper cmdlets from the Package Provider module (for example: Windows Container provider brings Find-ContainerImage)

Find-ContainerImage

image

 

Hope this all makes sense…
Hope this helps…