<img height="1" width="1" src="https://www.facebook.com/tr?id=1953097804934218&amp;ev=PageView &amp;noscript=1">

Blog

7 PowerCLI Learning and Coding Tools I Learned about at VMworld 2016 US

With VMworld 2016 US coming to a close, there’s no time like the present to review one of the major tracks from the conference. Up first, one of the main pillars of VMware automation and scripting: PowerCLI.

A PowerCLI primer:

PowerCLI is a VMware-focused extension to Microsoft PowerShell. While on the surface it looks and feels very much like Windows Command Prompt (cmd.exe), spend any time in PowerShell or PowerCLI and you'll notice that it is an altogether different beast. PowerCLI is an object-oriented scripting language designed to take the difficulty and time-consumption out of your most commonly repeated tasks. It uses “cmdlets” to issue commands in the “verb-noun” syntax. For example, “Get-VM” returns all of the Virtual Machines in an environment, whereas “Set-VMHostNetworkAdapter” makes changes to the NIC of a VMware ESXi Host. 

PowerCLI has been used for a multitude of different purposes, from simple scripts to entire deployments and configuration changes. It can even be used for running scheduled configuration checks and automatic remediation to make sure hosts, switches, VMs, and other objects are exactly where they should be. This is similar to Host Profiles, but is executed at a scripting level as opposed to being a vCenter feature. This means you won't need Enterprise Plus licensing, saving you some serious cash on your VMware deployment. 


Whether you’re just getting started with PowerCLI or are an experienced veteran, I’d like to share some of the resources from VMworld sessions that I’ve compiled for our team here at ServerCentral. Hopefully they can help you succeed with this incredibly powerful tool, too. 


Session 1: Getting Started with PowerShell and PowerCLI for Your VMware Environment [INF8038R]

View Session Video | Session Info

Chris Wahl (wahlnetwork.com) and Kyle Ruddy (thatcouldbeaproblem.com) did an excellent session on an introduction to PowerCLI. It was great in that it not only covered some basic cmdlets and ways to get around PowerCLI, but also had a couple gems in the Add-ons that are common for PowerCLI admins.

Tip: If you’re just starting out on PowerCLI, head over to the excellent VMware Hands-On Labs to get your feet wet. Go to http://labs.hol.vmware.com/HOL/catalogs/catalog/123 and search for HOL-SDC-1607, From Beginner to Advanced Features with PowerCLI. You'll need to create an account if you don't have one already, but it's worthwhile. Here's the lab documentation.) 

Tools and resources from this session:

Session 2: Enforcing a vSphere Cluster Design with PowerCLI Automation [INF8036]

View Session Video | Session Info

If you’re past the basics and your environment is all set up, then a great practical application session was Enforcing a vSphere Cluster Design with PowerCLI Automation. Presented by Duncan Epping (yellow-bricks.com) and Chris Wahl (wahlnetwork.com), this session dives into a great example of automated cluster checking and remediation. Furthermore, they dig into the vSphere API, which can be called by PowerCLI (typically via the “get-view” cmdlet), for advanced functionality not found in the top-level PowerCLI cmdlets. 

Tools and resources from this session:

But wait, there's more!

Example scripts and pre-built tools:

Session 3: The Power Hour, Deep Dive, DevOps, and New Features of PowerCLI [INF8092]

View Session Video | Session Info

If you’re a scripting veteran or if you’re just curious and want to see what PowerCLI is really capable of, there was an incredible Deep Dive session by two masters of PowerCLI: Alan Renouf (http://www.virtu-al.net) and Luc Dekens (http://www.lucd.info). In 60 minutes, Alan and Luc go heavily into the API, covering features like script optimization, streamlining report generation speed, and a lot more. Perhaps most importantly, Alan discusses a major shift in PowerShell itself: the transition from Windows-only to Linux and Mac OSs. This is a huge jump for VMware as a company, which is aggressively expanding beyond its traditional, Microsoft-only roots (as evidenced by its move away from the Windows-only C# client to the OS-agnostic Web Client and its move to the vCenter Server Appliance.

FYI, this session is going to require a few viewings. There's just that much good stuff in there. Still, it's a great resource to see some atypical examples of PowerCLI usage. 


Now get out and start scripting!

It's amazing how much time you'll save once common tasks can be automated. Stay tuned for more VMworld recaps, including a post on the future of the vSphere Client for those of you who hate CLIs and love your GUI (and if that’s the case, why are you still reading this article?!).

Topics: Tips