VMworld 2018 Roundup: Day 4

VMworld 2018 Logo

No general session to start off Wednesday at VMworld. Let’s get underway.

A Deep(er) Dive with PowerCLI 10 [VIN1992BU]

Presented by Luc Dekens and Kyle Ruddy, this session covered some advanced approaches and considerations for your PowerCLI code. Some of these methods are not specific to PowerCLI, meaning they work with PowerShell in general, but were still very welcome given that PowerCLI is a gateway to PowerShell for lots of VMware customers.

Note that any code I present here has been transcribed from my handwritten notes, so I can’t guarantee that I jotted the examples down 100% correctly.

Drawing from the Olympic motto, “Citius, Altius, Fortius” (higher, faster, stronger) a number of improvements were demonstrated. For example, limiting the number of calls to a cmdlet can notably improve performance. For example, rather than calling a for-each loop and then running a cmdlet on each object within the loop, the cmdlet can be called once against all the objects, which are then filtered or sorted as needed.

Try to execute lookups once, and pick faster methods. For example,  instead of piping to where-object use the x.where method. You can also do the same with for-each: x.ForEach(‘Name’).

Take advantage of splitting to create multiple variables using a single lookup:

You can work with vSphere objects in two ways:

The second method above is the faster of the two approaches.

Even Get-View can be made faster:

The second method demonstrates what is effectively pre-filtering the output by restricting the data returned by the lookup. Using dot notation you can even retrieve nested properties, as the Hardware.SystemInfo.Uuid property shows. As you can see from the example, you can also literally pre-apply filtering to your returned output. All of these efficiencies allow Get-View to work more efficiently and complete more quickly.

Wait for the right event in the most efficient way. For example, rather than requesting to start a VM and then looping over and over to see if the power state has changed yet, check the vCenter events to see what the outcome of your requested action is. Make sure to check for both the expected state, in this case the VM powering on, and unexpected states. After all, things don’t always work as expected and our scripts should react appropriately.

Try to use Try/Catch to address failures instead of silently continuing cmdlets and reacting via if/else statements. Note that you may need to run your cmdlet with -ErrorAction Stop in the Try block to force an explicit error on failure. Otherwise the Catch block may not execute. Also pay attention to $_. It behaves differently in Try/Catch, becoming an error object in the Catch block. Instead, use explicit variable names in both Try and Catch as that will work and maintain consistency.

Guest operations are available via APIs, which in turn interact with vmware-tools. Luc created Invoke-VMScriptPlus, taking advantage of these APIs, to execute actions within the guest operating systems.

Try to avoid the ForEach (alias %) and instead use the ForEach-Object, as it’s more efficient:

You can also now SSH natively with PowerShell by using the Posh-SSH module. PuTTY’s no longer required for allowing PowerCLI to make SSH connections.

The best scripts are made before you open up your code editor. Make sure you think through what you want your script to do before you start to write and you’ll improve the quality and efficiency.

Finally, check out Code Capture in the vSphere HTML5 Web Client fling. It’s the successor to Onyx, and allows you to capture the PowerCLI equivalent to actions you perform in the web client. It’s now only available in the fling and works on vSphere 6.5. I presume 6.7 support will come in future.


I spent the rest of the morning catching up on blogging and chatting with peers in the VMTN area of the VMVillage. The Blogger tables are a great place to have conversations with fellow bloggers, vExperts, and others. If you follow a community member online, chances are good that you could catch them for a quick thank you or chat in this area.

It has also become sticker-central for all things vCommunity. This year sticker mania hit new extremes, with both blogger tables blanketed in the colorful adhesives. While the sticker exchange, if you could call it that, has become a fun and core experience in the VMTN area, I hope the organizers consider a dedicated sticker table or area next year.

After my fill of community and one last tour of the Solutions Exchange, which closes at end of day on Wednesday, I attended one of the VMware{code} sessions.

Building and Monitoring IOT with Liota and Wavefront by VMware [CODE5546U]

This hands-on interactive session had participants connect to a Raspberry Pi on the bench in front of them and configure it to act as an IoT device and gateway. The Pi had a barometer on it, and we were given instructions to install Liota. Liota was configured to send the barometer data (the temperature detected by the sensor) and send it to Wavefront.

Wavefront could than be used to visualize the data. By default the metric could be seen in a graph, showing the temperature change over time. Wavefront could also be used to create dashboards that could show the data in context of other data, as well as using different means, such as other visualizations or in a table.

This was a very interesting experience and was eye opening about how quickly and easily VMware’s tools enable edge-based IoT devices to retrieve and action data.

You can see what was required for running Liota on the Raspberry Pi by checking out the Maker Space Raspberry Pi Liota/Wavefront Lab blog post.

VMworld Fest

As always, Wednesday hosted the conference celebration. This year it was branded as the VMworld Fest instead of party. It was held at The Pavillions at World Market, and consisted of two large, connected tents or domes. Within that space, four unique areas were setup with food, music and interactive elements like games or photo opportunities. I took in the fest for a while, but ultimately the venue felt too small for the size of the crowd, and the lines for food stretched out to turn into half hour waits. I bowed out before it finished, but hear that fest goers enjoyed the musical acts VMworld arranged.

Wednesday wrapped. ‘Till next time.



Dee Abson

Dee Abson is a technical architect from Alberta, Canada. He's been working in the field of technology for over 20 years and specializes in server and virtualization infrastructure. Working with VMware products since ESX 2, he holds several VMware certifications. He was awarded VMware vExpert for 2014-2018. You can find him on Google+ and Twitter.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: