If you’ve ever used Linux then you will have always wanted a Package Management tool for Windows. Yes, Windows has a third-party Package Management tool called Chocolatey which can be run using the command line. But, Windows 10 brought in OneGet a native Package Management tool as announced by Microsoft’s Garret Serack in a blog post. It’ll let you install/uninstall and update software packages with NuGet Package Manager using Powershell. Also, it has support for Chocolatey repository too.
Note: With the Windows 10 RTM release OneGet has been renamed to PackageManagement.
So, let’s see how you can effectively install/uninstall and update multiple software packages using OneGet (PackageManagement). And, also, see how to integrate Chocolatey with it.
What are OneGet (PackageManagement) and Chocolatey?
For non-Linux users and those that don’t know anything about package management, Package Manager makes installation, updating, and uninstallation of software (package) very easy. Package Manager makes use of a repository where all the software packages are stored.
You simply need to enter a command to get those software packages and install them on your PC. With just a single command you can install or update the software. Updating is done automatically whenever the software is updated in the repository. So, that’s what Package Manager is all about.
Now, OneGet as a tool is one step ahead. It’s a manager of a Package Manager. It can host multiple repositories like Chocolatey and NuGet. We’ve already spoken about Chocolatey before. Chocolatey can work with the command prompt. NuGet contains software packages specific to Microsoft’s Application Development tools. You can enter a single command and grab software from these repositories.
How to Use OneGet?
So, first let’s see the available commands. You can see it in the feature image above. To see the commands that are available type in the following command in Powershell.
Get-Command -Module PackageManagement
Remember, not OneGet but PackageManagement (I’m writing here OneGet just for simplicity). So, now you have the list of commands. Now, let’s start by checking which package sources (package managers) we have.
Get Package Sources
Type in the following command (or just copy it):
You should get the Package Sources that are installed on your system.
So, I have only the built-in PowerShell gallery installed. Now, let’s install the Chocolatey Package Manager. If you already are seeing Chocolatey in the list then skip the next step.
Enter the following command:
Get-PackageProvider -Name Chocolatey
Get-PackageProvider will find the package repositories that are available and install it.
Hit Enter and Chocolatey installation should start. After installation completes, check again the package source with the command you applied before. You should see Chocolatey.
Next, we need to set Chocolatey as default Software Package source. We’ll use set-packagesource command to set it as default. Enter the following command:
Set-PackageSource -Name chocolatey
Now as we’re all set let’s install a software from the chocolatey repository.
Install Software from Chocolatey Repository
You get more options with Chocolatey. You need not go to Chocolatey’s website and find the software you want to install. You can find that from Powershell itself using the find-package command. So, let’s say you want to find all packages related to ‘Chrome’.
find-package -name Chrome
Now you’ll get all the packages with Chrome keyword in it along with a summary. Now, from this list, I’ll install Adblockpluschrome.
install-package -name adblockpluschrome
Enter Y and installation will start.
No upgrade Command available
Surprisingly, OneGet doesn’t have an Update command. There’s an update command in Chocolatey but that won’t apply here. This issue was reported on GitHub back in 2014 when Technical Previews were being shooted to the Insiders and it still hasn’t been solved.
Wanna become a Command Prompt Ninja? Here’s a list of function key shortcuts that will make you one.
Now, that you know the basics, you can explore further the commands and parameters. If you think OneGet hasn’t delivered a top notch service then you can always opt for Chocolatey and use it via the Command line.
ALSO SEE: 3 Command Prompt Alternatives That Are Better than the Default
Last updated on 02 February, 2022
The above article may contain affiliate links which help support Guiding Tech. However, it does not affect our editorial integrity. The content remains unbiased and authentic.