How to Install Chocolatey Packages Offline


In my previous post Getting Started with Chocolatey and Boxstarter I showed you how to prepare your infrastructure for an Enterprise Chocolatey and Boxstarter Environment.

Now an vanilla OS is not of much usage for us, so we need to create Chocolatey Packages for our local repository. Creating Chocolatey Packages for Offline usage is much simpler than real packages that you want to distribute to the Chocolatey Repository since we don´t need to add all those details to the nuspec file.

There´s a couple of short-cuts that we can leverage and I also learned some lessons the hard way (spending way more hours than planned). This blog post will tell you all about it, and the best part, I´ve prepared a NUPKG Starter Pack that you can download to get a flying start. Let´s jump straight into it.

In my previous post we installed the App-V 5 RDS Client, App-V Scheduler and the Citrix Virtual Desktop Agent. I preferrer to deliver all applications through App-V, but there´s still some Core Applications that needs to be installed in the Master Image. Here is my current deployment script:

So how do we create these Chocolatey applications for offline usage? Well I´m using Julien Stanojevic´s install logics based upon the Chocolatey install logics.

Why? Well we don´t need the Download $URL used by Chocolatey since we´re going to host all binaries in our local ChocoRepository.

So let´s say you want to create a Chocolatey package for Classic Shell. That application is probably in the public repository already so just head over to the site and then click the Download link to get the NUPKG.

Classic Shell

When we open the file in Nuget Packet Explorer you can easily find the download URL and the silent argument. Download the setup file and place it in your ChocoReository.

Classic Shell NUPKG

Create the install logics with the unattended switches ($FileArgs):

Save the file as e.g. Box.txt and create the package.

Upload the NUPKG to MyGet and then delete all files from C:\Box (Boxstarter Local Repository). Check my previous article for full details.

I was having a REALLY hard time with custom Powershell scripts and the XenAppWorker job. When the installation was launched from my launcher machine (BS-01) the job was just hanging and there where no logs what so ever to help me out.

So after a couple of sleepless nights I figured out it would be a good idea to try doing a cinst packagename locally on the machine in question!

Boom! The Powershell script stopped because of the Unblock-File cmdlet and XenDesktopVdaSetup because of the stupid Open File Security Warning (my GPO didn´t work as expected). So to fix this I simply changed the Powershell ExecutionPolicy from Unrestricted to Bypass:

To fix the Open File Security Warning I created a Powershell script to Disable Zone Checking at the beginning and Enable it again at the end. Read more about it here.

When working with packages that fails, you can edit them directly in Nuget Packet Explorer. Remember to change the version number, save as and upload to MyGet. The installation routine by Chocolatey and Boxstarter will always pick the latest version.

Package Metadata

If you do a clist you will see the packages and the version number.

Chocolatey clist

Automation is King, but when it fails it´s a pain in the ass. But don´t worry, download my NUPKG Starter Pack which are packed with examples and binaries to get you a flying start and save 40 hours of work that I´ve spent to make it easier for you!

Extract the NUPKG Start Pack ZIP file to the root of your ChocoRepository and upload the various NUPKG files to your MyGet account.

Let´s push it.


Nice, 20 minutes to install everything completely unattended (on the slowest EC2 instance). Even App-V Scheduler is configured to bring in all our virtualized applications.

App-V Scheduler




Automation Framework Community Edition

The fastest way to build your lab environment.

Virtual Expo

Friday 30th of September 2022

Leave a Comment