Using OneGet PackageManager in Windows 10 and Windows 2016 Server Container

I am experimenting with OneGet, the new Powershell PackageManager for Windows. It is included in Windows 10 and in Windows Server Container and Windows Server 2016.

The PackageManager is something I learned to appreciate when I was experimenting with Docker on Linux. There we use apt-get to get software from a web-repository and install this on my Linux machine. When it comes to Docker and you want to auto-install a server this is really valuable, because you can install software from the command line.

There was not a real alternative in Windows…untill now. It is called OneGet and there is little documentation about it. The great thing about OneGet is that is actually a Manager for Package Managers. You can refer to other package managers and have a unified experience in OneGet. OneGet runs in Powershell.

There is a widely used package manager that installs software on Windows. This is called Chocolatey. And … You can use this in OneGet.

Let me lead you through an example to install Git from the commandline using OneGet. This works on Windows 10 and Windows Server 2016. On Windows 8.1, you first need to register OneGet with Powershell. Find instructions here.

First we open a Powershell window and there we type

register-packagesource -Name chocolatey -Provider PSModule -Trusted -Location -Verbose

Now we have instructed OneGet to look at both NuGet (default Package Manager) and chocolatey to find packages.

Then we can look at all packages available. You can browse to the chocolatey website or you can type

Find-Package | Sort-Object –Property Name | Out-GridView

There we also see the package [Git].

Then install the package by using the command you find everywhere Install-Package Package

Install-Package git

And then you’ll get an error.

WARNING: The module ‘git.install’ cannot be installed or updated because it is not a properly-formed module.

And that happens with all modules. After searching for a while I found it!! You have to provide the -ProviderName to it so it looks at chocolatey and not at the default NuGet provider. So instead type

Install-Package git -ProviderName chocolatey

And then … it installs !!!

Hope this helps !

Update 12-29-2015: the ProviderName on Windows Server Container 4 is not PSModule but PowershellGet


2 Responses to “Using OneGet PackageManager in Windows 10 and Windows 2016 Server Container”

  1. Thank you very much! Fixed my problem on windows 2016 tp3 core


  1. Running a VS Team Services (VSO) Build Agent in a Windows Docker Container | The Road to ALM - February 15, 2016

    […] Using OneGet PackageManager in Windows 10 and Windows 2016 Server Container […]

%d bloggers like this: