Comparing and contrasting vSphere PowerCLI and vRealize Orchestrator

Although vSphere PowerCLI and vRealize Orchestrator accomplish many of the same things, they go about automation in distinctly unique ways.

There are two main products for automating an environment that uses VMware software: vSphere PowerCLI and vRealize...

Orchestrator. Before choosing which product to use, you should understand what specific functions these tools perform. In this article, we'll take a closer look at their capabilities, the role they play in a VMware environment, and what sets them apart to help potential users make an informed decision. Fortunately, both PowerCLI and vRealize are cost-effective options for VMware users, since PowerCLI is free, and vRealize Orchestrator is included in your vCenter license.

Write commands and scripts with PowerCLI

PowerCLI is an extension of Microsoft PowerShell that allows you to use PowerShell commands -- also known as commandlets or cmdlets -- to communicate with your vSphere environment. By installing PowerCLI on your workstation, you can execute commands and scripts as well run scripts on a central host, which is essentially just a Windows server that runs the scripts on your behalf.

This powerful toolbox enables you to perform all of the tasks you'd execute from the vSphere Client or vSphere Web Client from the command line and also from a script. This is especially helpful when it comes to automation because you can put repetitive tasks in a script and run them as needed.

With PowerCLI, a task that normally takes hundreds of clicks can be performed with just a few commands in a single script. This saves time and improves consistency because every time you execute your script, it will run the exact same commands in the exact same order, eliminating human error during execution. There is, of course, always the possibility for human error when creating the script.

You can also use PowerCLI to create scripts for other scenarios, such as performing a post-install configuration for an ESXi server or restoring the configuration of a failed host. PowerCLI is better suited for this task than the esxcli commands that you execute on the ESXi host itself or via the vSphere Management Assistant appliance. Like the esxcli command set, PowerCLI allows you to perform server-based tasks, with the added bonus of working with all other types of objects in your environment, including networking, storage and VMs. PowerCLI lets you automate tasks and offers reporting features for your environment, including reporting on VM snapshots. With PowerCLI, you have the option to run both simple and complex commands.

Execute workflows with vRealize Orchestrator

Now that we've acquainted ourselves with PowerCLI, let's turn our attention to the vRealize Orchestrator. VRO is a server-based product that you can either install on a Windows server or download as a Linux appliance. Both editions offer the same features, so it's up to the user to decide which one she'd prefer to use. Since vRO comes with a graphical workflow design engine, there's no need to work with commands, though the tool does give you the option to use them if you so choose.

Compared to the vSphere Client and vSphere Web Client, vRO's automated workflows create snapshots at a much faster rate. Although vRO does not require users to script with commands, you do need a basic understanding of some programming concepts, such as how to use an if-then statement with a Boolean parameter, how a loop works, and what input and output parameters are. You can build most workflows for day-to-day operations and other automation tasks with the graphical workflow designer. You can also create a workflow that performs a post-configuration of an ESXi host with vRO. If the default actions and workflow elements do not sufficiently meet your needs, you can use JavaScript to customize your workflows.

PowerCLI vs. vRealize Orchestrator

Although PowerCLI and vRO fulfill many of the same duties, there will come times when it makes more sense to use one instead of the other, and other times when you'll need to use both to perform different tasks. The best way to decide which tool to use is to examine use cases to determine their strengths and weaknesses.

When it comes to performing simple tasks, PowerCLI has the upper hand over vRO, since it's much easier to perform tasks from your workstation than to build a workflow in Orchestrator. Compared to the example shown in Figure A, creating a snapshot with PowerCLI requires significantly less time and skill. It's also much easier to use PowerCLI to create a simple script with a set of commands to perform a post-install configuration or an ESXi host than it is to create a workflow for the same purpose in vRO. However, this disparity evens out once you begin writing more complex scripts in PowerCLI.

One drawback to using PowerCLI is that it runs from your workstation or a PowerShell host, neither of which is the best environment for repetitive tasks that need to be scheduled and run autonomously. If your computer or the PowerShell host crashes during the execution of a script, you could end up with an inconsistent environment. PowerCLI does not offer a great deal of high availability, so it is not well-suited for systems that require continuous access to automation capabilities.

In this aspect, vRO has the advantage. Since it already runs as a server component, it is more robust and less prone to execution failures. Should your server fail during the execution of a workflow, vRO knows to pick up where you left off once the workflow is restarted. Additionally, vRO offers a feature in which you can place two or more Orchestrator servers in a cluster so that when one fails, the other can continue to execute the workflow. This makes vRO a better choice for scheduled tasks that have to run autonomously and are started through a product such as vRealize Automation or any of the systems that you run in your own environment. VRO also allows you to execute workflows through the HTTP REST API and integrates with the vSphere Web Client. The latter capability allows you to share workflows with co-workers without have to log them onto the Orchestrator client. Although PowerCLI has a fling that enables you to run PowerCLI scripts for the Web Client, it's less user-friendly than the vRO integration.

Other bonuses to using vRO are its extensibility and the default set of plug-ins that come with it, as these features allow you to work through vCenter and other external systems. VRO has a number of third party plug-ins to choose from and integrate with, an overview of which can be seen on the VMware Solutions Exchange website. VRO also includes a versioning mechanism with the ability to export complete workflow packages, including all dependencies, for use in another environment. This is useful because it makes it easier for users to collaborate with co-workers when creating a library of components and to then share their library with customers or sell it. This capability is located in vRO's central database, so provided you keep a backup, it also gives you a safer repository in which to store your work.

Choosing the right automation tool

When it comes to choosing between PowerCLI and vRO for automation, I suspect that the majority of administrators will opt to use PowerCLI. This is because most administrators have some preexisting knowledge of PowerShell or other scripting languages and will find PowerCLI more intuitive than vRO. The threshold for getting started with PowerShell is lower, thanks to the wealth of tutorials for both PowerShell and PowerCLI available online, which makes it an appealing choice. However, I'm certain that administrators who invest the time and effort into learning how to use vRO will find it just as effective a tool as PowerCLI.

For many environments, it makes sense to invest time in both offerings -- PowerCLI for operations you want to execute yourself, and vRO for tasks that must be scheduled and automated to and from external systems and for those that you intend to share with others. Fortunately, VMware Education offers a course titled "Data Center Automation with vRealize Orchestrator and vSphere PowerCLI" to help admins get acquainted with both tools.

Next Steps

Real-world applications for PowerCLI

Explore the vRealize Suite's automation capabilities

What's the difference between vRA and vRO?

Dig Deeper on Scripting administrative tasks