How do I use Windows 10 built-in package manager?

13

4

I'm finding Windows 10 package management not very intuitive. Below are my adventures in trying to install VLC, which sounds like a very common test case for a package manager.

Find-Package vlc

Nope

Find-Package -Update

Nope

Install-Package --help

Nope

Install-Package /?

Nope

Install-Package vlc

The provider 'nuget v2.8.5.127' is not installed.
nuget may be manually downloaded from https://oneget.org/nuget-anycpu-2.8.5.127.exe and installed.
Would you like PackageManagement to automatically download and install 'nuget' now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):
Install-Package : No match was found for the specified search criteria and package name 'vlc'.
At line:1 char:1
+ Install-Package vlc
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Nope

Register-PackageSource -Name chocolatey -Location http://chocolatey.org/api/v2 -Provider PSModule -Trusted -Verbose

Maybe?

Install-Package vlc
WARNING: The module 'vlc' cannot be installed or updated because it is not a properly-formed module.

Nope

Jonathan

Posted 2015-08-15T16:22:35.437

Reputation: 1 287

Try Install-Package -Name VLC.

– MC10 – 2015-08-15T16:31:34.710

Install-Package -Name VLC Install-Package : No match was found for the specified search criteria and package name 'VLC'. – Jonathan – 2015-08-15T16:35:00.490

Does Find-Package -Name VLC find anything for you? Also, check if it's case sensitive. – MC10 – 2015-08-15T16:36:01.797

Find-Package -Name VLC Find-Package : No match was found for the specified search criteria and package name 'VLC'. At line:1 char:1

  • Find-Package -Name VLC
  •   + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exceptio
     n
      + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
    
  • < – Jonathan – 2015-08-15T16:37:24.133

So I played around with it some more. I got the same error you did for VLC but installing putty worked. Not sure who's side the problem is on now. – MC10 – 2015-08-18T14:02:11.887

I'm having similar problems with iojs. It finds the package just fine, but when I try to install it, it says its not found. – mpen – 2015-08-23T01:00:28.260

help Install-Package works. – BrunoLM – 2015-10-31T21:40:14.647

1You might wanna do a update-help first. – BrunoLM – 2015-10-31T21:47:29.037

Is there any advantage to using Windows' commands rather than chocolatey directly for package that come from the chocolatey repo? – kuzzooroo – 2017-12-02T23:52:03.890

Answers

10

You were close. First, you have to set the execution policy to allow scripts, otherwise it'll silently fail while reporting success (bug):

Set-ExecutionPolicy RemoteSigned

Both the package provider (Chocolatey plugin) and package source (URL to specific Chocolatey repo) need to be installed/registered with PackageManagement. Get-PackageProvider with the -Force flag causes it to bootstrap, which apparently takes care of both (more in the help about -Force):

Get-PackageProvider Chocolatey -Force | Out-Null

Then I can search for the package:

Find-Package vlc -Force

Name       Version          Source           Summary
----       -------          ------           -------
vlc        2.2.1.20150630   chocolatey       VLC Media Player

And install it (-Force so it doesn't prompt for confirmation):

Install-Package vlc -Force | Out-Null

enter image description here

Vimes

Posted 2015-08-15T16:22:35.437

Reputation: 368

This doesn't work for me on a clean Windows 10 RTM, it just puts everything in C:\Chocolatey\lib but doesn't actually install the programs or run the scripts required to do so. – RedShift – 2015-09-19T14:01:48.050

3

Oh, there's a terribly confusing bug in PackageManagement where that exact behavior happens unless, before installing packages, you set the execution policy to allow scripts (I use RemoteSigned). I'll update my answer.

– Vimes – 2015-09-19T19:12:29.477

1Great to hear. Hopefully they'll get these wrinkles ironed out. Don't forget to mark the answer if you like :-) – Vimes – 2015-09-20T16:10:00.593

How would I install multiple packages in one line? That's the industry standard for all package managers. It appears I get an error if I run Install-Package vlc firefox -Force – Jonathan – 2016-01-19T23:34:06.687

1@JonathanLeaders, just put commas between the package names. – Vimes – 2016-01-20T20:16:06.513

@JVimes This doesn't seem to work anymore. The error is similar to RedShift. If execution policy is set to RemoteSigned the script errors out with The system cannot find... ; if you reset the execution policty with Set-ExecutionPolicy Default it doesn't error out but nothing is installed into Program files. The installers are correctly deposited in C:\Chocolatey\lib – xenithorb – 2017-01-06T18:58:28.703

@xenithorb, I confirm what you're seeing. I had so many problems with the Chocolatey provider I gave up on it long ago. Looks its GitHub page is here.

– Vimes – 2017-01-06T19:22:00.473