Posh-ChocoBear

Filed under: PowerShell

Introducing Posh-ChocoBear, a PowerShell module for installing and using Chocolatey. Lately, I’ve had to install custom chocolatey installations with multiple feeds and I’ve been having trouble enabling users and devs to get chocolatey setup when it goes beyond just running the install script.

Chocolatey is a package manager for windows, which is a way of saying that it is a command line app store. The cool thing about Chocolatey is how versatile is, the documentation only scratches the surface.

Having users install Chocolatey in a specific location was hard because of the extra steps it required. I wrote a simple script to help with that, but users issues running the script. The biggest thing I run across is seeing people paste the code right into the shell rather than saving the code in a script and then running it.

I’m aware of the DSC, Desired State Configuration, for Chocolatey. Getting users, who really don’t have an IT staff to back them up, to use it is even harder than getting them to run a script.

The other issue with the script is that it was specific in the feeds that it was installing. So I would have to modify the script each time I added a feed. I don’t know how common it is for users or companies to have custom installs or Chocolatey, but my sake and others, I decided to create a module to help make that easier.

The other issue is getting people to remember parameters for chocolatey. One of the shortcomings of cmd is that the lack of autocomplete for parameters. To help with that, I created PowerShell commands that wrap choco install, choco upgrade, and choco uninstall. The goal was to keep things simple as the ChocolateyGui is still in flux. ChocolateyGui has yet to release a new version with the new branding, which is easier on the eyes.

The other reason for the module, I plan on releasing an extension to chocolatey in the future that focuses on packages like nginx, git, mysql, ruby, python, etc. For the most part, you really don’t need the MSI installers for those packages. The lack full control over their processes and the pain switching between different versions of each program for testing has burned me one too many times.

So this is me, doing something about it.

Technically, you don’t need to use the MSI to install programs, you can run MSIEXEC /a to extract the installer contents and then have full control over how and where and how a package installs. This can enable usb and user installs with MSI and it avoids all the extra entries in the registry.

Posh-ChocoBear isn’t signed yet, but I’m currently in the process of getting a code signing cert to fix that.

The bonus to using the Posh-ChocoBear module is that it allows for users to create configs for custom chocolatey installs and store that in OneDrive. The module will look for that config and use the config to Chocolatey in a specific location and add all the feeds specified in the configuration.

After a few iterations on the improving the Posh-ChocoBear module, I’ll write up a full tutorial and video on how to use it. I plan on writing a full tutorial on using Chocolatey in general, so be on the lookout for that.

The README for the project contains instructions on how to use the module. Early adopters can ping me on social media with any issues or on the Posh-Ops project.

Disclaimer: I invested in the Chocolatey KickStarter.

Nerdy Mishka