In Windows 10, Microsoft has finally baked a package manager called OneGet into Windows. It works similarly to apt-get and other package managers that have been around for decades in the Linux world; just works in PowerShell, rather than bash. So let’s take a quick peak. First, import it as a module from a PowerShell prompt:
Import-Module -Name OneGet
Next, use Get-Command to see the options for the OneGet Module:
Get-Command -Module OneGet
This will show you the following options:
Find-Package
Get-Package
Get-PackageProvider
Get-PackageSource
Install-Package
Register-PackageSource
Save-Package
Set-PackageSource
Uninstall-Package
Unregister-PackageSource
Next, look at the repositories of package sources you have:
Get-PackageSource
You can then add a repo to look at, using Register-PackageSource. Or, we’ll just fire away at locating our first package, Acrobat:
Find-Package -Name AdobeReader
Or you could pipe that output to the Install-Package option:
Find-Package -Name AdobeReader | Install-Package
Or Firefox, verbosely:
Install-Package -Name Firefox -Verbose
Or ASP.NET MVC silently (using -Force):
Install-Package Microsoft.AspNet.Mvc -Force
In some cases, you can also use the -Version option to define a specific version, which is why I ended up writing this in the first place – swapping between versions of asp has been a bit of a pain since the introduction of its first update, it seems…