Advanced Development with PowerCLI

By Brian Bunke

Elevator Pitch

What can you do to make life easier as a developer working with VMware PowerCLI?

Test code without a lab? Fix older practices highlighted by your editor? Mock vSphere inventory objects?

Well…yes!

Description

Checking the PowerCLI code you write requires VMware infrastructure. That infrastructure isn’t free, and it can wildly vary from install to install. As a result, each test (automated or manual) costs precious time and money.

This session will attack the problem from three different angles:

  • Run integration tests against a vCenter simulator inside a Docker container, mocking common vSphere APIs
  • Extend PSScriptAnalyzer with custom PowerCLI rules, catching outdated practices before the next code commit
  • Generate mock vSphere objects to help unit test your strongly-typed parameters

You’ll leave with multiple solutions to help improve the consistent quality of your PowerCLI code.

Notes

This is a huge barrier preventing further open source collaboration in the VMware ecosystem. “Worked in my lab” is no better than “worked on my machine,” and a headache and timesink soon follows. In addition, this issue discourages new contributors from entering the community, as having a VMware environment available to bang on already self-selects for more senior and economically-stable people.

My primary motivation for delivering this session is to increase cooperation in the PowerCLI community while simultaneously decreasing the overall time commitment.