Chocolatey is a package management system that helps you download and install software packages. Unlike the PowerShell Gallery, Chocolatey is not limited to PowerShell modules and scripts and can install a wide variety of software including tools like Notepad++, Acrobat Reader, or the Chrome browser.

Using Chocolatey is trivial if you are prepared to run it in an elevated shell with full Administrator privileges. While there are instructions on how to make Chocolatey work without full privileges, it is almost guaranteed you run into problems.

To use Chocolatey from PowerShell, download its install script and run it. This requires Administrator privileges:

# download installation code
$code = Invoke-WebRequest -Uri 'https://chocolatey.org/install.ps1' -UseBasicParsing

# invoke installation code
Invoke-Expression $code

After this, you can use the new “choco” command from within PowerShell. Just make sure you run it in an elevated shell.

A list of installable packages (like Acrobat Reader or Google Chrome) can be found here:

https://chocolatey.org/packages

To install a Chrome browser, for example, run this:

choco install googlechrome -y

Again, when you run “choco” from a non-elevated PowerShell, you get a warning message, and most of the software packages will not install correctly.



You are a PowerShell Professional, passionate about improving your code and skills? You take security seriously and are always looking for the latest advice and guidance to make your code more secure and faster? You’d love to connect to the vibrant PowerShell community and get in touch with other PowerShell Professionals to share tricks and experience? Then PowerShell Conference EU 2020 might be just the right place for you: https://psconf.eu (June 2-5, 2020 in Hanover, Germany).

It’s a unique mixture of classic conference with three parallel tracks filled with fast-paced PowerShell presentations, and advanced learning class with live discussions, Q&A and plenty of networking.

Secure your seat while they last: https://psconf.eu/register.html.

Twitter This Tip! ReTweet this Tip!

Anonymous