VMware has released a new version of its PowerCLI power tool, a command-line interface for automating vSphere and vCloud management. As with all products, the initial few versions had some flaws that were corrected in the subsequent versions.
The latest version, PowerCLI 6.5, has addressed most of the vulnerabilities and flaws. In fact, it is leaps and bounds better than the previous versions. More importantly, it has a rewritten module for Horizon View that makes remote management a breeze.
Before going into how you can use PowerCLI for Horizon View, let's briefly understand the basics.
What is PowerCLI?
Simply put, PowerCLI is a command-line and scripting tool that allows you to automate and manage VMware components from your Windows PowerShell. It has more than 500 cmdlets that give you complete control over vSphere, vCloud, and Horizon View.
Now that you have a basic idea of PowerCLI, let's look under the hood of the new version.
PowerCLI 6.5 features
According to an official release from VMware, the new features of this version are based on feedback from users. In this sense, PowerCLI 6.5 addresses many of the drawbacks in previous versions, and also has many cool features that will make automation and remote management easy.
Here are some of the enhanced features.
Many cmdlets have been added to improve the stability and performance of virtual software. A notable update is "Move-VM," which allows you to perform what is known as Cross vCenter vMotion, so you can now move vMotion VMs between different vCenters. Also, this cmdlet helps you traverse between different SSO domains, and this is something that was not available in the previous versions.
Another cmdlet, "Open-VMConsoleWindow," is updated to provide access to VMware Remote Console (VMRC).
The storage module has big and exciting changes in this version. Now you can automate the entire vSAN cluster creation process, run tests, update the HCL database, and do so much more.
In addition, you don't need to manage the VM's hard disk through a VM, rather you can now do it independently with PowerCLI cmdlets. The obvious advantage with this move is you can decouple the handling of a virtual disk's lifecycle from that of a VM's lifecycle, and this is sure to give you a ton of flexibility.
PowerCLI 6.5 is backward compatible with all vSphere versions up to 5.5, while the storage module is compatible with vSAN 6.0. This backward compatibility adds to your choices, especially when you want to decide on the right VM configuration for your needs.
Horizon View module
The most significant feature of PowerCLI 6.5 is an integrated PowerShell support for the view component of Horizon 7.
Let's take a deeper look into what we get from the PowerCLI Horizon 7 module.
PowerCLI for Horizon View
The addition of a new Horizon View module to PowerCLI 6.5 allows you to manage Horizon View from a remote connection. What this means is you'll be able to access all the features available in the UI, automate it, and use it from a scripting host, along with the other PowerCLI features.
Breaking it down, you get three components: the Horizon 7 module, access to View API, and scripts written in PowerShell to invoke different advanced functions.
Horizon 7 module
PowerCLI 6.5 has two powerful cmdlets to manage Horizon View. Mainly, it allows you to connect and disconnect from the View API service, and through this, gives you access to all the capabilities of View API. The best part: This is outside of the Horizon Administrator Console.
Besides this access, you can also now run PowerCLI 6.5 scripts from remote workstations and servers to connect to Horizon 7. This gives you better flexibility than ever before as you can now connect from anywhere -- including the administrator's desktop!
To top it off, you can write scripts across the entire VMware assets.
View API access
View API is a web service available for any Horizon Connection server. This API is widely used by administrators to configure, administer, and monitor the server at any time. With PowerCLI 6.5, you can use the different variables and methods in this API to programmatically access the Horizon Connection server.
How nice would it be if you don't have to write scripts for interacting with pools, farms, and desktops? Well, the Horizon 7 team thought just like you, and this is why they have made available a set of scripts that cover common operations. All these scripts are available in GitHub, and you can download them when you want.
Now that we know what it offers and why it’s significant, let's see what happens when you take PowerCLI out for a spin.
Getting started with PowerCLI for Horizon View
First off, install PowerCLI 6.5. This installation comes with three core components and three optional components. We've discussed the three core components above, so let's look at the optional components so you can customize the installation process to your liking.
- vCloud PowerCLI provides the VMware.VimAutomation.Cloud and VMware.VimAutomation.PCloud that can be useful for automating vCloud Director and vCloud Air.
- vSphere Update Manager offers the VMware.VimAutomation module for automating vSphere Update Manager.
- vRealize Operations Managers gives the VMware.VimAutomation.vROps module for automating some features in vCloud Director and vCloud Air.
Once you've installed PowerCLI 6.5 and launched it, you'll see that we have two cmdlets to work with. The next step is to login into your Horizon View server using your login credentials.
With this, you should have access to View API.
When you login, you'll have access to two variables. The first one is DefaultHV servers -- a global variable that stores the connection to Horizon View servers. This variable can be accessed by $global: DefaultHVServers.
The second variable is Extensiondata, the variable that holds access to the entire API. You can use this variable to get all the information you want. To know more about the different methods and objects you can access, go through the VMware View API documentation.
In short, PowerCLI 6.5 is a powerful tool that allows you to have better control over different VMware modules and assets through Windows PowerShell scripts. Specifically, its power to remotely connect to Horizon View servers can make life a lot easier for virtualization specialists. Its simplicity and comprehensive reach is sure to make it an indispensable tool for anyone using VMware services.