Feb 19

PowerCLI and vCenter Server Appliance (vCSA) 6.0 – Working with JSON

So the title is a little missleading… This is totally just a PowerShell feature, but hey, why not do it from PowerCLI (I find myself having more PowerCLI consoles open than PowerShell anyways!)

With the new vSphere 6 release coming and a fresh new vCSA, I wanted to share my experience with deploying this via PowerShell. In the past I’d mostly worked with XML files for configurations and had yet to actually work with JSON in PowerShell, so when I saw that the vCSA had JSON configuration templates I decided it was time for me to jump in and get my hands dirty.

Where to start

First things first. We have a couple of different options for deploying the vCSA.

Option 1: Through your web browser using the Client Integration Plugin. This will guide you through a number of screens where you will fill out all of the properties needed by the vCSA to deploy and run.

Client Integration Plugin
Option 2: Using the vcsa-deploy CLI and editing the JSON template in a word editing program.

vCSA JSON Template

Option 3: Use PowerShell/PowerCLI to edit the JSON template and run the vcsa-deploy CLI.

PowerShell JSON

I enjoy creating scripts that I can use later so I opted for Option 3.

Editing JSON in PowerShell

This is a pretty straight-forward once you’ve done this before, but for those who haven’t let’s walk through the process. First we need to pull the JSON file into PowerShell so we can manipulate it. We can do that by running a command like the following:

once we’ve run this command, we now have a PowerShell object that we can work with.


The editing here is very similar to what we do when we work with the ovfconfiguration object as of PowerCLI 5.8r1. As you can see when we call our variable we have specified, it returns all the properties of the given object. We can dig deeper into each one by adding the name of the property to the end of our variable string.


in the case of vCSA, to change the value of a property we have to include quotation marks around the property name because the property itself includes a period. If we do not use quotation marks, PowerShell will give us an error.

JSON Config1 You can see that the new value saved to the esx.hostname property. I could continue with this example through all of the properties but I’d rather not bore you. Just understand that to update a value you’ll need to specify the property, add ‘=’ and then the new value.

After we are done editing our configuration as a PowerShell object, we need to save it back out as a JSON file. to do this we run the following:

We can go look at our JSON file now. If we are pleased with it, we can then run vcsa-deploy:


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

5 × four =