Chocolatey – a sweet package manager for Windows

Some days ago a friend of mine talked some curios things about chocolate or something like that, to me. First I did’not understand, what he’d like to say, but than it became a little clearer to me.

Chocolatey…, is no sweet or something of that kind, but it is a powerful new package manager for Windows user, that Safes a lot of time.

The old way

As a user afflicted with permanent System Setups and therefor permanently reinstalling the most common tools that are often used, like Notepad++ or KeePass , I found chocolatey sweet as chocolate.

Chocolatey is, as I mentioned before, a Kind of Package Manager like opkg, apm or other package manager known from Linux OS. Developers – mainly Visual Studio Devs – know that concept from NuGet. With that Chocolatey it’s now pretty simple, keeping the own local repository of tools clean and maintainable with a Windows OS.

Consider the following scenario (you know that, of course):
You have a PC, that is fresh and clean – reinstalled after a system crash (or for other reason ). Now you have to go through a huge list of often used tools, that you can recall. But most times you are not catching all of them. So you are engaged with installing tools a long time after reinstallation.
Ok…. lucky guy, if you have all of the tools as portables saved to an USB stick, but in that moment, you don’t know, where to find this stick or it’s laying around some where in your home – where you are not.
Same applies to uninstalling software. Sometimes you do not have installed software and you don’t know, where it has been saved to. In that case, you either have to install other software to search for executable like Everything Search Engine or do it by hand. In all cases, it is hard to overcome his inhibition, to setup a new WinOS.

With Chocolatey things are changing…

I wrote a little powershell script, that keeps a of all tools, I need for my daily life. As an IT Pro, I often need Notepad++, KeePass, 7zip, GitHub, RegexTester, TreeSize and a lot more. This Script does the following. It downloads Chocolatey, if not already installed. It continues looping through my list of tools and  installs them each by another. The good thing with this approach is, that I have not to care about where to retrieve install files, updates and there is no more spamming of my download folder with Zips.
That script is saved to my OneDrive, so I have it “with me”, where ever I have to setup a machine.

Starting with Chocolatey (Homepage)

open up a Powershell as Administrator an type in the following line
iex ((new-object net.webclient).DownloadString ‘https://chocolatey.org/install.ps1’))
(there is also a solution for cmd at theire hompage)

Now you can start installing a tool. Let’s take regextester!
Type choco install regextester 

You will be asked for permission to install, by typing 1 for YES
(that could be automated by the use of –y at the end of a install command)
What I also should mention is the fact, that, if a tool is, for example no installable (portable for example), choco generates an icon and a link, to find and execute it by mouse for example.

The chocolatey repository could be searched by two ways: at their hompage or from powershell choco list/search <keyword>
e.g. choco search regex
leads to following result:

Your local repository could be reviewed by
choco list –l

And removing a tools could not be any easier
choco uninstall recuva.portable

Updates, if there are any, could be made by
choco upgrade notepadplusplus

Conclusion

With these simple commands your own local repository is maintainable in an easy and fast way. The benefit of replaying these actions, either automated ore by hand, in “forward/backward”-style is so sweet, that I use it now consequently on all my dev-machines and friends PCs for maintenance. Build your own script or use mine and you will see, it could not be more simple.

(add that code to a file e.g. chocolatey_install.ps1 and call it with parameter 0, if you like to make a fresh install of chocolatey and tools or only upgrading local repository)

param([bool]$upgrade=1)

$tools = @(
“7zip”, #Packer
“notepadplusplus”, #texteditor
“procexp”, #process explorer (Task manager)
“adobereader”, #PDF reader
“keepass.install”, #password manager
“treesizefree.portable”, #getting filesizes (sorted/visualized overview)
“irfanview”, #picture viewer
“winmerge”, #comparing files and folders in file system (also usable with TFS)
“rdcman” #manages RDP sessions
)

if($upgrade -eq 0){
iex ((new-object net.webclient).DownloadString(‘
https://chocolatey.org/install.ps1′))

$tools | % {choco install $_ -y}
}
else
{
$tools | % {choco upgrade $_ -y}
}

9 Antworten auf „Chocolatey – a sweet package manager for Windows“

  1. Choco install allows multiple calls (so does upgrade).

    So you don’t have to make those calls one at a time.

    choco install git -y -params ‘”/GitAndUnixToolsOnPath /NoAutoCrlf”‘
    choco install -y notepadplusplus 7zip 7zip.commandline beyondcompare conemu fiddler4 grepwin stexbar lessmsi nuget.commandline puppet vim gitextensions sysinternals baretail

    1. Hey Rob,
      thanks for adding comment. You are right. Good point!
      I didn’t invest so much time into that script. So, it is not optimal, but every one is welcome to tune it up 😉

  2. Thanks for your marvelous ρosting! I really enjoyeⅾ rᥱading it, you’re a gгеat authoг.
    I will be suгe to bookmark your blog and definitely will
    come back at som ⲣoint. I want to еncourage that you cⲟntinue your
    great job, have a nice morning!

  3. I’m really іmpressed aⅼong with your writing talents and
    also with the forat to your ԝeblog. Is this a paiԀ suЬjeϲt oг did you modifgy it yoursеlf?
    Either way keеp up the exceⅼlent hіgh quality writing, it is uncommon to
    lօok a nice wenlog like tҺіs one nowɑdays..

  4. I tɦink this is among thhe most significant information for me.

    And i am glad reading yօurr articⅼe. But shⲟuld remark оn few general things,
    The ite style is ⲣerfect, the articles is really nice : D.
    Good job, chеers

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.