13

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

MC10
  • 10,620
Jonathan
  • 1,782

1 Answers1

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
  • 472