Getting Started with Chocolatey and Boxstarter

37 Shares

I´ve been playing around with labs hosted in the cloud for quit some time. The biggest drawback is the lack of Layer 2 Networking.

This means that since we don´t have L2 access it´s not possible to do e.g. PXE boot for MDT or SCCM. My Automation Framework works perfectly on-premise, but simply won´t run in any private cloud for that reason.

Luckily I´ve been given beta access to the brand new Citrix WorkSpace Cloud (CWC). Now with CWC you can run your workloads on-premise or in a private cloud. My Automation Framework already supports CWC, but since I want to test out private clouds as well I needed to figure out another way around for Automation.

Citrix Workspace Cloud 02

How do we get started with Chocolatey and Boxstarter and make it Enterprise Ready? Let´s jump straight into it.

I´m going to use 2x vanilla Windows Server 2012 R2 called BS-01 and BS-02 which are joined to my domain. BS-01 is going to be the Source and BS-02 the Target.

Connect to BS-01 and download the setup from Boxstarter.

Getting Starter with Chocolatey and Boxstarter 15

After installing Boxstarter on BS-01 launch Boxstarter Shell and install the following packages:

You need to host your install scripts (NuGet packages) online. There´s a excellent free service for that called MyGet. Create an account and your feed. Take note of the Nuget package feed URL.

Getting Starter with Chocolatey and Boxstarter 01

Now let’s download Chocolatey 0.9.8.3 and customize it for our Enterprise needs.

Open the file in NuGet Package Explorer and expand Tools – ChocolateyInstall. Edit the Source to point to your Nuget Package Feed URL.

Getting Starter with Chocolatey and Boxstarter 18

Save the package and upload to MyGet.

Now open %AppData%\Boxstarter\Boxstarter. Chocolatey\Boxstarter.zip and extract it to C:\Boxstarter. Then open C:\Boxstarter\boxstarter.config and change the NugetSources and ChocolateyPackage.

Getting Starter with Chocolatey and Boxstarter 17

Why do we do this? Well, since we´re going to make this Enterprise Ready we want to have full control over our binaries and not install “unsecure” apps from the cloud like we did with NotePad++ and Nuget Package Explorer above. We also want to host the binaries on-premise so the deployment time is much faster, and most importantly so we can create custom apps that you will never find in the Chocolatey Repository.

Now rezip C:\BoxStarter to BoxStarter.zip and copy & replace %AppData%\Boxstarter\Boxstarter.Chocolatey\BoxStarter.zip.

Why do we do this? Well, when you select to deploy on a vanilla target machine that BoxStarter.zip is copied from the Source and extracted on the Target.

From Boxstarter Shell run the following commands to add your Repository and Remove Chocolatey in Boxstarter:

Then run the command clist to show your packages (which at the moment is none).

Getting Starter with Chocolatey and Boxstarter 19

This will later reflect the packages in your MyGet account later.

Getting Starter with Chocolatey and Boxstarter 06

Chocolatey install logics uses the environment variable ChocoRepository. So you need to create a network share to host your binaries and create the environment variable in Group Policy.

Getting Starter with Chocolatey and Boxstarter 03

While you’re at it, make sure that you have the file server hosting the ChocoRepository trusted. If not this won’t roll because of the stupid File Security Warnings.

Administrative Templates – Windows Components – Internet Explorer – Internet Control Panel – Security Page – Site to Zone Assignment List.

Getting Starter with Chocolatey and Boxstarter 12

The format for the binaries are $Vendor $Product $Version. If there’s no vendor like App-V Scheduler I just drop the Vendor folder.

Getting Starter with Chocolatey and Boxstarter 04

Let’s create a package for App-V 5 SP3 RDS.

First we need to define the BoxStarter Local Repository. Let’s create a catalog called C:\Box and change the Boxstarter config.

Getting Starter with Chocolatey and Boxstarter 08

Open up NotePad++ and paste the following (Chocolatey install logics):

Getting Starter with Chocolatey and Boxstarter 09

Save it as C:\AppV5.ps1 on BS-01. Now let’s create a .nupkg packge.

Run the following command:

Getting Starter with Chocolatey and Boxstarter 10

Now upload App-V5.0SP3RDS.1.0.0.nupkg to MyGet.

Getting Starter with Chocolatey and Boxstarter 11

WARNING: Please delete everything from C:\Box after upload to MyGet. If you don’t you will receive lots of strange errors when deploying!

Repeat for any other applications that you want to include in your main installation script.

Now the Citrix VDA setup requires some customization so we’re going to use some custom install logics from Julien. Remember to change the FQDN of your Delivery Controllers.

And finally the package that installs all the Roles and Features + our packages for a Citrix XenApp Server.

Okay, are you ready to roll? Let’s try it out.

Getting Starter with Chocolatey and Boxstarter 13

What’s awesome with BoxStarter is that it take care of reboots when needed.

Getting Starter with Chocolatey and Boxstarter 14

That’s it. Might seem like a lot of work, but it’s pretty cool when you get used to it. Now that your have your Framework up it’s just adding more and more packages to your repository. Have fun.

Resources:

37 Shares

Automation Framework Community Edition

The fastest way to build your lab environment.

Virtual Expo

Friday 30th of September 2022

6 thoughts on “Getting Started with Chocolatey and Boxstarter”

  1. Hi,

    How does the installation work on the distant server ( BS-02 for you)? Does BS-02 needs a internet connection to download the package and execute the script?

    Thanks.

    Reply

Leave a Comment