Nano Server PowerShell Package Management

Nano Server PowerShell Package Management

In Nano Server roles, features and drivers live outside of the basic Nano Server Image in Nano Server packages. Nano Server Packages can be found on the Windows Server 2016 media in the Nano Server folder under Packages. You can the New-NanoServerImage or Edit-NanoServerImage PowerShell cmdlets to add them while creating or editing a Nano Server Image. If the Nano Server is already running you have to use PowerShell Package Management to add roles and features to the Nano Server. Here is how this works

Import the Nano Server PowerShell Package Provider

Nano Server PowerShell Package Management

# Import PowerShell Module
 
Save-Module -Path$env:ProgramFiles\WindowsPowerShell\Modules” -Name NanoServerPackage -MinimumVersion 1.0.0.0
 
Import-PackageProvider NanoServerPackage

Search for available Packages

 

# Find Nano Server Package
 
Find-NanoServerPackage

Online install Nano Server Packages on the running Nano Server

Install Nano Server Package PowerShell Package Management

# Online Install Nano Server Package
 
Install-NanoServerPackage -Name Microsoft-NanoServer-Containers-Package

Offline install Nano Server Packages to a VHD or VHDX file

# Offline Install Nano Server Package
 
Install-NanoServerPackage -Name Microsoft-NanoServer-Conainers-Package -culture de-de -RequiredVersion 10.0.14393.0 -ToVHd C:\NanoServer\Images\Nano01.vhdx

Download and save Nano Server Packages

You can also download the latest version of Nano Server Packages, so you can add them later using the New-NanoServerImage PowerShell cmdlet.

# Download and save a Nano Server Package
 
Find-NanoServerPackage -Name *containers* -MaximumVersion 10.2 -MinimumVersion 1.0 -Culture de-de | Save-NanoServerPackage -Path C:\NanoServer\Packages

Get Installed Nano Server Packages (Online)

# Get Installed Nano Server Packages (online)
 
Find-NanoServerPackage -Name *containers* -MaximumVersion 10.2 -MinimumVersion 1.0 -Culture de-de | Save-NanoServerPackage -Path C:\NanoServer\Packages

Get Installed Nano Server Packages (Offline)

# Get Installed Nano Server Packages (offline)
 
Get-Package -provider NanoserverPackage -fromVhd C:\NanoServer\Images\Nano01.vhdx

I hope this helps you how to handle Nano Server Packages using PowerShell Package Management (OneGet).