It has been a year since we initially released PackageManagement (a.k.a. OneGet) feature in Windows 10. PackageManagement automates software discovery, installation, and inventory (SDII), regardless of the package formats or where the packages are from. During this past year, PackageManagement has expanded to other Windows SKUs and versions, including:
- For down-level OS (Windows Server 2012 R2, Windows Server 2012, Windows 2008 R2 SP1, Windows 8.1, and Windows 7 SP1), it is part of the Windows Management Framework (WMF) 5.0
- It has been included in Nano Server since Windows Server 2016 Technical Preview 4 (TP4)
Today I will focus on its usage and providers on Nano Server.
As you may know, Nano Server is a new deployment option of Windows Server that has a tiny footprint and runtime. The model for Nano Server is to start small and then add only the features/components that you will use. So PackageManagement is a core technology of Nano Server and the results are stunning: Windows Server with a Desktop is about 10 GB, Server Core is about 5GB and Nano Server is about 440MB.
One of the ways Nano Server is so small is because it does not support the GUI stack or 32bit code. This means that a PackageManagment provider running on Windows 10 or full server may not be able to run on Nano Server anymore, because of the API that the provider depends on is not available. You will need to port the provider first. You can leverage these two tools to analyze the code,
Also, you will see a different set of providers available on Nano Server. Below is a recap of the PackageManagement architecture and provider list on Nano Server.
Except for PowerShellGet provider that comes in the box, all other providers will be installed on demand. Let’s explore the cmdlets that PackageManagement provides.
For a complete usage of each cmdlet, please read the Technet doc.
Install a PackageProvider
The common steps to install a package provider are:
|PS C:\> Install-PackageProvider <ProviderName>PS C:\> Import-PackageProvider <ProviderName>|
You can add –force to both cmdlets to overwrite an existing provider. Use Get-PackageProvider to list providers that are installed in the local machine.
Software Discovery/Install/Inventory (SDII)
Once the provider is installed and imported, you can search, install, inventory software packages from that provider. In general, you can use the generic PackageManagement cmdlets to do so. For each provider, it may provide its own cmdlets specific to the package type, such as the PowerShellGet, ContainerImage, NanoServerPackage providers. This way, depending on your experience and usage, you can choose between the generic PackageManagement cmdlets and the specific cmdlets for that particular type of package. Here is a quick introduction for each provider available on Nano Server.
PowerShellGet manages PowerShell modules and scripts stored in an online gallery. By default, PowerShellGallery.org is the package repository.
NuGet provider is a special provider. It is a protocol provider in the sense that it handles NuGet V2 protocol to connect to any package source (or repository) that is based on NuGet V2 server. PowerShellGallery.org is an example. Hence PowerShellGet relies on NuGet provider to connect to its gallery. On the other hand, it is a package provider to manage NuGet packages, such as those in NuGet.org.
ContainerImage provider can search, download, or install Windows container OS images from an online gallery. It is new in Windows Server 2016 Technical Preview 5 (TP5). For more information, please read the ContainerImage on GitHub for the provider, and the Container MSDN doc on how to manage Windows Containers.
NanoServerPackage provider can search, download, or install Windows packages (feature and role) for Nano Server from an online gallery. It is new in TP5. For more information, please read the NanoServerPackage on GitHub for the provider, and Getting Started with Nano Server doc.
WSA is a new installer on Nano Server. WSAProvider wraps on top of APPX cmdlets and provides search capability for WSA packages from a local folder or network share. You can find more information on WSA here and WSAProvider on GitHub.