VMware vSphere PowerCLI Reference. Graf Brian

Читать онлайн.
Название VMware vSphere PowerCLI Reference
Автор произведения Graf Brian
Жанр Зарубежная образовательная литература
Серия
Издательство Зарубежная образовательная литература
Год выпуска 0
isbn 9781118925140



Скачать книгу

more than once, automate it!”

      Who Should Read This Book

      The book is, of course, primarily targeted at administrators of vSphere environments who want to automate tasks. But the subjects that we discuss in the book cover so many aspects of the management of a VMware vSphere environment that everyone who comes into contact with a VMware vSphere environment will be able to pick up something useful.

      In our day-to-day contact with PowerCLI users, we noticed that most of them start with what we like to call the reporting phase. Thanks to the natural look and feel of PowerShell and PowerCLI, it is quite easy for beginners to produce impressive reports about their vSphere environment. That’s why we included several chapters on different types of reporting. The somewhat more advanced user will go into the configuration phase. That is the moment when you start changing settings on your virtual guests and in the vSphere servers. This book contains an extensive number of chapters for this phase.

      The ultimate phase you can achieve through the use of PowerCLI is the process automation phase. As an administrator, you are now going to automate complex processes in your vSphere environment. This process can range from automating the deployment of vSphere servers all the way to automating the switch to a disaster recovery center. Again, the book offers several chapters for this phase.

      Since PowerCLI runs as a module in PowerShell, you might think that you have to be a Windows administrator to profit from the book. Although that is indeed the targeted audience, there are some automation aspects that are only (or at least easily) accessible through the PowerCLI module. So, even if you are primarily a *nix shop, you can still benefit from using PowerCLI for some of your administrative tasks.

      What You Will Learn

      The book shows you how you can use PowerCLI to automate your administrator tasks – not an alphabetical listing of the 450+ PowerCLI cmdlets, but a practical guide with example functions and scripts that you can use immediately in your environment. The chapters are organized in such a way that each of them reflects a specific type of task. You probably already have done most of these tasks more than once. Now, we will show you how to automate them. In other words, you script them once and run them multiple times.

      Several of the scripts we show are quite long, at least for a PowerShell script. Of course, you will not have to type them in. You will be able to download all the scripts from the book’s update page:

      www.wiley.com/go/vmwarevspherepowercli2e

      To run the scripts, you can start up the PowerCLI prompt, enter cmdlets interactively, or provide the name of the PS1 file you want to execute. Most of the scripts do not have the extensive annotations you will find on our blog posts; the book had to be a manageable size. Also, since a book has a limited page size, we often had to break single lines in our scripts over two or more lines on the printed page. The scripts that you download have the original, optimized layout.

      What You Need

      Software is a dynamic organism; it will have successive versions, releases, and builds. Because a book has to be published at one point in time, we aligned all our scripts and sample code on a specific set of versions. The following list contains the versions of the software we used to develop and test the scripts in this book:

      VMware vSphere PowerCLI, version 6.0

      VMware vCenter Server, version 6.0

      VMware ESXi, version 6.0

      PowerShell, version 4.0 RTM and 5.0 preview

      OS Platform, Windows 7 or higher

      To know which operating systems you can use to run the PowerCLI cmdlets and scripts, you will have to look at the release notes that came with the PowerCLI build you are using.

      A number of graphical environments are available that allow you to execute cmdlets and scripts. Programs like the PowerShell ISE, PowerGUI, and PowerShellPlus all give you a GUI-based editor from which you can run and debug your scripts.

      What Is Covered in This Book

      VMware vSphere PowerCLI Reference: Automating vSphere Administration broadly follows the life cycle of your VMware vSphere environment:

Part I: Install, Configure, and Manage the vSphere Environment

      Chapters 1–5 show you how to automate the installation and configuration of your VMware vSphere environment. They include a discussion of the vCenter Server, the ESX and ESXi servers, storage, and networking as well as some advanced vSphere features like host profiles and dvSwitches.

      Chapter 1: Automating vCenter Server Deployment and Configuration takes you through some common areas automated within vSphere, starting at the beginning of the virtual infrastructure. Not only will we show you how to automate the build, but we’ll also provide examples of scripts that will help you export information into a centralized area ready for use in reports or for the import process of another setup.

      Chapter 2: Automating vSphere Hypervisor Deployment and Configuration briefly walks you through the various installation methods before taking a deep dive into automating that last 10 percent. In this chapter, we will cover several techniques for streamlining the installation and configuration of vSphere.

      Chapter 3: Automating Networking covers automation in one of the most critical components of a virtual environment: networking. We also take an introductory look at VMware NSX.

      Chapter 4: Automating Storage features deploying a new cluster with new storage or maintaining and upgrading existing storage, automation can come to the rescue to help you save time and maintain consistency of configuration. We also look at VMware Virtual SAN.

      Chapter 5: Using Advanced vSphere Features focuses on automating some of the most advanced features vSphere offers. EVC, vFlash Read Cache, DRS Groups, Fault Tolerance, and more: if you want to configure all the bells and whistles, this is the chapter!

Part II: Managing the Virtual Machine Life Cycle

      Chapters 6–10 tackle all the automation aspects of guests – from creating a virtual machine and svMotion all the way to vApps. We will show you how to mass-deploy a number of guests and how to manipulate snapshots.

      Chapter 6: Creating Virtual Machines explores the various methods of creating new virtual machines, including how to scale up deployments while maintaining quality control. We will highlight several techniques for installing and maintaining VMware Tools.

      Chapter 7: Using Templates and Customization Specifications covers creating templates, creating customization specifications, deploying guests, and maintaining templates over the long term. When it comes to deploying virtual machines, the tools provided are templates and customization specifications. Their use is a key part of any administrator’s game.

      Chapter 8: Configuring Virtual Machine Hardware begins after your environment is all set up and running. Perhaps performance is lacking and you need to throw in an additional vCPU or more memory. Or maybe your disk is running to its maximum capacity and needs to be extended. All of these tasks and other reconfiguration tasks are covered in this chapter.

      Chapter 9: Advanced Virtual Machine Features shows you how to interact with the guest operating system using the operating system’s native tools and through the PowerCLI methods. Next, you explore how to script vMotion, Storage vMotion, and Cross-vCenter vMotion operations. Finally, we cover creating and maintaining snapshots.

      Chapter 10: Using vApps shows you how to import virtual appliances, create your own vApps, maintain vApps, and simplify complex applications by providing vSphere valuable metadata about a group of VMs. You’ll learn about start order, network protocol profiles, using IP assignments, and modifying vApp product information.

Part III: Securing Your vSphere Environment

      In Chapters 11–14, we discuss the security aspects of your VMware vSphere environment. First, we show you how to handle backups and restores. Then, we continue with the automation of your disaster recovery. Patching and hardening of your environment conclude this part.

      Chapter 11: Backing Up and Restoring Your Virtual Machines examines one of the most critical