James Thew - Fotolia

Get started Bring yourself up to speed with our introductory content.

Cook up automation recipes with VMware PowerCLI commands

Slinging code to control your vSphere environment can ease your workload and help reduce errors that are introduced by manual administration.

If you're a vSphere administrator, you may not be able to escape from the constant refrain to automate certain procedures so you are not manually fiddling with the same settings or endlessly pointing and clicking to execute the same tasks. Adding some VMware PowerCLI commands to your repertoire is a good first start; stringing these commands together to build a complicated workflow is the next best thing.

Using PowerCLI allows vSphere administrators to automate and report on many of the products in VMware's portfolio. PowerCLI is a Windows PowerShell snap-in, so administrators who are familiar with the Microsoft platform may have already experimented with some scripts on the Windows side.

While all this automation sounds wonderful, getting past the intimidation factor if you've never produced a script is one mental hurdle that you'll need to overcome. To that end, the PowerCLI Cookbook by Philip Sellers can ease you into the world of PowerShell. Sellers's book features 75 "recipes" you can use to control the disparate pieces of your vSphere environment.

In chapter one -- download and read this chapter in PDF format by clicking here -- Sellers talks about the benefits to automation and starts with some basic tasks. Sellers explains how to connect to an ESXi host, which makes other cmdlets -- there are about 400 cmdlets at your disposal -- accessible, then adding that host into Active Directory.

As mentioned in the connecting section, joining an ESXi host to Active Directory offers the ability to connect without entering credentials for administrators. Active Directory is a Windows implementation of Lightweight Directory Access Protocol (LDAP). Active Directory contains accounts for users, computers, and groups. Active Directory runs on a Windows Server that has the Active Directory role installed and that has been "promoted" to become a domain controller. To perform this recipe, you will need at least one Active Directory server available on the network with the ESXi host.

Seamless authentication is one of the biggest reasons to join a host to Active Directory. But beyond single sign-on, once the ESXi host is connected to Active Directory, groups in the directory can be leveraged to grant permissions to the ESXi host. If you do not have Active Directory installed and do not wish to, you may skip this recipe and move on to other topics of host configuration without any impact to future recipes.

Editor's note: The chapter excerpt from PowerCLI Cookbook is available courtesy of Packt Publishing.

Download the complete chapter now

Next Steps

Gain better control over VMware vCloud and vSphere with PowerCLI commands

VSphere CLI vs. PowerCLI vs. ESXi Shell

Twelve easy-to-digest PowerShell tips, tricks and hints

This was last published in May 2015

Dig Deeper on Scripting administrative tasks

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What are some PowerCLI scripts you've developed?
Cancel

-ADS BY GOOGLE

SearchServerVirtualization

SearchVirtualDesktop

SearchDataCenter

SearchCloudComputing

Close