Want to learn PowerCLI but don’t know where to start?
Already using it and want to progress to the next level?
This guide is initially intended for my colleagues but it may help others scripters as well.
There are already many great resources to learn PowerCLI, so instead of reinventing the wheel, I have reviewed them to estimate at which learner’s level they will be the most suitable.
PowerCLI is primarily for VMware administrators, so before thinking about PowerCLI it is necessary to be one.
“With great power comes great responsibility” and PowerCLI is really powerful so I recommend a VCP level minimum.
PowerCLI in context:
If you do not understand this schema yet, don’t worry it will become clear very soon.
The goal is to demonstrate that PowerCLI is part of a rich ecosystem.
As shown in the above schema:
PowerShell is built on the .Net framework.
PowerShell can access all of the underlying .Net capabilities. For example the System.Math Class is often called from PowerShell to round number.
PowerShell has many native cmdlets and a rich language with many operators like “If / ForEach etc”
PowerCLI extends PowerShell and provide cmdlets to manage different aspects of VMware.
It is possible to “jump” from PowerCLI to the VMware vSphere API.
Evaluate your level:
Please evaluate your PowerShell and PowerCLI level.
Little to zero experience in PowerCLI/PowerShell.
You have achieved a basic level of proficiency, learned the fundamental skills and use them in a functional manner in a production environment. This is similar to a VCP level.
You have achieved an advanced level of proficiency. You can now script fast and in an optimized way and can probably handle nearly any challenges. VCAP level
You are a reference in the industry recognized for your skills. VCDX level
And the bad news, your final PowerCLI level is equivalent to your weakest point in PowerShell or PowerCLI. This is how I discovered in the hard way that I was not at an Advanced level like I was thinking but at a Professional level due to my lack of knowledge in PowerShell. I was not using the full potential of PowerShell and due to this I was not using the full potential of PowerCLI.
Resources recommended based on your level:
Many of the resources in lower level will be also useful at a higher level as a refresher or to provide different perspectives.
Rookie to Professional:
Learning PowerCLI February 2014
Basis of PowerCLI/PowerShell are introduced in the first 3 chapters.
The remaining chapters contains many scenarios.
This is convenient for people who like “Theory first then practice”
PowerCLI cookbook March 2015
75 step-by-step PowerCLI recipes and for each a summary in the form of “How it works”
Basis of PowerCLI/PowerShell are introduced along the way.
This is convenient for people who like “Practice and learn theory at the same time”
It also contains information on how to connect to vCloud Director from PowerCLI
The two above books are enough to start with PowerShell and PowerCLI, but if you would like to push more on the PowerShell area i will recommend at this stage:
Sams Teach Yourself Windows PowerShell in 24 Hours May 2015
It provides a very good learning curve.
Professional to advanced:
PowerShell in Depth, Second Edition October 2014
If you have already skills at the PowerShell level this book will help you to reach the next level.
VMware vSphere™ PowerCLI Reference: Automating vSphere Administration April 2011
The first edition was “the” reference when it was published however PowerCLI has been improved since.
Some topics are not up to date anymore like dvswitches. Native PowerCLI cmdlets are now available for this.
It provides a lots of functions that will help you to create your own, and some of them are really using the API at and advanced level.
Note: The second edition will be released early 2016. I am strongly looking forward to it.
Advanced to guru:
Practice as much as possible.
Provide help in the PowerCLI community. It will expose you to more challenges than you will have on your own and you will learn from others as well. Luc Dekens is a perfect example.
Always try to improve your knowledge in all areas of the PowerCLI ecosystem (PowerCLI/PowerShell/.net)
Stay up to date with latest released of PowerShell and PowerCLI and identify if some new features will be suitable for new scripts or improve old ones.
Follow twitter linkedin for anything including PowerCLI and all PowerCLI/Poweshell bloggers that you deem of interest.
Create something new to fulfill some needs and share it. vCheck from Alan Renouf is an example of such tool.
Read VMware documentation for developers.
And the most important have fun.
Manage VMware with PowerShell but without PowerCLI:
The PowerCLI team improves PowerCLI with every releases.
As a general rule it will be recommended to use PowerCLI cmdlets if they are available. (There are legitimate exceptions)
However they are a lots of things that are not available yet as native PowerCLI cmdlets.
In the meantime it is still possible to manage VMware components from PowerShell alone.
New-CimSession can be used to establish a CIM session
Invoke-RestMethod could be used to connect to any VMware REST APIs.
For the above topic i strongly recommend one chapter of this book:
Chapter 10. Manage the vRealize Automation Center by utilizing REST APIs through PowerShell
VMware vSphere PowerCLI Overview A must to have in your web browser bookmarks
vSphere PowerCLI Documentation Check if new release are available and read the release notes.
VMware vSphere PowerCLI User’s Guide
VMware vSphere™ PowerCLI Community
VMware vSphere API Reference A must to have in your web browser bookmarks. API are reacheable from PowerCLI via get-view and .extensiondata
vSphere API and SDK Documentation For advanced users, many topics here could be useful, for example “VMware CIM SMASH/Server Management API for ESXi Documentation” if you would like to dig deeper in this topic.