Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
PowerCLI Cookbook
PowerCLI Cookbook

PowerCLI Cookbook: Over 75 step-by-step recipes to put PowerCLI into action for efficient administration of your virtual environment

Arrow left icon
Profile Icon Philip Brandon Sellers
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (4 Ratings)
Paperback Mar 2015 274 pages 1st Edition
eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Philip Brandon Sellers
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (4 Ratings)
Paperback Mar 2015 274 pages 1st Edition
eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

PowerCLI Cookbook

Chapter 2. Configuring vCenter and Computing Clusters

In this chapter, you will cover the following topics:

  • Creating a virtual datacenter in vCenter
  • Creating a cluster and adding ESXi hosts
  • Setting cluster advanced features, including HA, DRS, and EVC
  • Setting up resource pools
  • Setting up folders to organize objects in vCenter
  • Setting permissions on vCenter objects

Introduction

A single ESXi host allows you to run multiple virtual machines on a single server, but to tap the full potential of power from vSphere, you're going to need vCenter and clusters of ESXi hosts. This chapter will cover the basic concepts of creating and managing pools of resources using vCenter and multiple ESXi hosts.

vCenter is an increasingly critical part of the vSphere infrastructure since it handles the coordination of clustering and automation across multiple ESXi hosts. This drives the change and increases the complexity of vCenter deployments in each new version of vSphere. Even while the vCenter deployments are becoming more complex, VMware is working to try and ease that management by packaging the solution in simpler ways. vSphere 5.1 introduced the new Single Sign-On (SSO) service to the platform, and vSphere 5.5 streamlined deployment of the SSO's second version in vSphere. vSphere 5.5 also improved the virtual appliance version of vCenter, known as the...

Creating a virtual datacenter in vCenter

vSphere has several defined objects that are used to create virtual datacenters. For example, an object named Datacenter sits at the root of vSphere and allows the clusters and other host infrastructures to be placed inside the virtual datacenter. Installations might have multiple datacenters; however, most VMware administrators use additional datacenter objects in vSphere to represent a physical site and use the datacenter object as a boundary where the infrastructure exists. In this recipe, you will take a look at the code needed to create your new datacenter object in vCenter.

Getting ready

For this recipe, you will need to open a PowerCLI prompt, you need the DNS name or IP address of your vCenter host, and the password for the default administrator account in vCenter.

How to do it…

In order to create a virtual datacenter, and to create new datacenter object in vCenter, perform the following steps:

  1. The first step is to connect to your vCenter...

Creating a cluster and adding ESXi hosts

Clusters are the basis for everything that is great within vSphere. Clusters are the level where individual resources become pooled and shared for virtual machines. Clusters allow all higher-level functionalities within vSphere, such as an automatic restart after a hardware failure and dynamic balancing of workloads. Individual ESXi hosts and clusters can exist at the same level under a datacenter object in vSphere.

In this recipe, you will walk through the steps necessary to set up your first cluster of servers in vCenter. You will be reusing the same four ESXi hosts that you configured in the Creating a configuration script to set all properties uniformly recipe from Chapter 1, Configuring the Basic Settings of an ESXi Host with PowerCLI.

Getting ready

This chapter assumes that your vCenter has the datacenter object defined and that you have individual ESXi hosts connected or managed by vCenter. In this example, you will call the Primary datacenter...

Setting cluster advanced features, including HA, DRS, and EVC

The previous recipe mentioned the advanced features of vSphere clusters. In this recipe, you will configure those advanced features since it is more common to reconfigure these settings than to initially set these settings.

The cluster settings you are going to be working with are HA, DRS, and Enhanced vMotion Compatibility (EVC) settings. In the vSphere Client, these settings are exposed in the Edit Cluster Settings option.

Creating a cluster is a one-time event, but as you deploy vSphere, you might not be ready to automate vMotions or Storage vMotions with DRS in your cluster from the beginning.

However, over a period of time, your comfort level with these automation technologies begins to increase and you would want to put the cluster on autopilot and change the automation level to be fully automated. You will cover how to do this and how to set up other common settings from PowerCLI.

PowerCLI is useful for these settings because...

Setting up resource pools

Resource pools are objects within vSphere where VM objects with similar performance requirements can be grouped together. Resource pools allow a priority to be set to pools of compute, memory, and disk resources, so that when the contention occurs, the hypervisor can choose which VMs get access to resources first. Resource pools exist within the cluster objects in vSphere or within host objects if a host is not a part of a cluster.

Getting ready

To begin this recipe, you will need to open a PowerCLI window and connect to a vCenter server. For the purpose of this example, we're going to configure two resource pools: Production and Development. The Production resource pool will be configured with the high setting for CPU and memory resources. The Development resource pool will be configured with the low setting for CPU and memory resources.

Sometimes, PowerCLI defines its normal conventions and resource pools is one of them. You can't simply pass a cluster...

Introduction


A single ESXi host allows you to run multiple virtual machines on a single server, but to tap the full potential of power from vSphere, you're going to need vCenter and clusters of ESXi hosts. This chapter will cover the basic concepts of creating and managing pools of resources using vCenter and multiple ESXi hosts.

vCenter is an increasingly critical part of the vSphere infrastructure since it handles the coordination of clustering and automation across multiple ESXi hosts. This drives the change and increases the complexity of vCenter deployments in each new version of vSphere. Even while the vCenter deployments are becoming more complex, VMware is working to try and ease that management by packaging the solution in simpler ways. vSphere 5.1 introduced the new Single Sign-On (SSO) service to the platform, and vSphere 5.5 streamlined deployment of the SSO's second version in vSphere. vSphere 5.5 also improved the virtual appliance version of vCenter, known as the vCenter Server...

Creating a virtual datacenter in vCenter


vSphere has several defined objects that are used to create virtual datacenters. For example, an object named Datacenter sits at the root of vSphere and allows the clusters and other host infrastructures to be placed inside the virtual datacenter. Installations might have multiple datacenters; however, most VMware administrators use additional datacenter objects in vSphere to represent a physical site and use the datacenter object as a boundary where the infrastructure exists. In this recipe, you will take a look at the code needed to create your new datacenter object in vCenter.

Getting ready

For this recipe, you will need to open a PowerCLI prompt, you need the DNS name or IP address of your vCenter host, and the password for the default administrator account in vCenter.

How to do it…

In order to create a virtual datacenter, and to create new datacenter object in vCenter, perform the following steps:

  1. The first step is to connect to your vCenter server...

Left arrow icon Right arrow icon

Description

If you are a virtualization professional who wants to unleash the power of automation and combat the complexity of sprawling virtual environments, this book is ideal for you. This book will enhance your skills of administering VMware vSphere and vCloud Director with PowerCLI.

What you will learn

  • Configure and administer VMware ESXi hosts, clusters, and vCenter Manage virtual machine configurations and operations Administer datastores, datastore clusters, and virtual machine snapshots Create and configure virtual networking in a vSphere environment Manage cluster features and affinity groups Make custom reports and notifications from vSphere Direct operations in vCloud Director

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 25, 2015
Length: 274 pages
Edition : 1st
Language : English
ISBN-13 : 9781784393724
Vendor :
Microsoft
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Mar 25, 2015
Length: 274 pages
Edition : 1st
Language : English
ISBN-13 : 9781784393724
Vendor :
Microsoft
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 125.97
Learning PowerCLI for VMware VSphere
€37.99
Mastering PowerCLI
€45.99
PowerCLI Cookbook
€41.99
Total 125.97 Stars icon
Banner background image

Table of Contents

12 Chapters
1. Configuring the Basic Settings of an ESXi Host with PowerCLI Chevron down icon Chevron up icon
2. Configuring vCenter and Computing Clusters Chevron down icon Chevron up icon
3. Managing Virtual Machines Chevron down icon Chevron up icon
4. Working with Datastores and Datastore Clusters Chevron down icon Chevron up icon
5. Creating and Managing Snapshots Chevron down icon Chevron up icon
6. Managing Resource Pools, Reservations, and Limits for Virtual Machines Chevron down icon Chevron up icon
7. Creating Custom Reports and Notifications for vSphere Chevron down icon Chevron up icon
8. Performing ESXCLI and in-guest Commands from PowerCLI Chevron down icon Chevron up icon
9. Managing DRS and Affinity Groups using PowerCLI Chevron down icon Chevron up icon
10. Working with vCloud Director from PowerCLI Chevron down icon Chevron up icon
A. Setting up and Configuring vCloud Director Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(4 Ratings)
5 star 75%
4 star 25%
3 star 0%
2 star 0%
1 star 0%
Chris Wahl Apr 19, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
One of the more difficult parts of learning PowerCLI - and PowerShell itself - is determining where to get started. I often suggest identifying a project or task that you want to complete, and then figuring out how to do it, because aimlessly fiddling with a language can be frustrating. If you're looking for a library of sample code that walks you through the why and how, I'd suggest picking up the PowerCLI Cookbook written by Philip Sellers.The book is published through Packt Publishing, who's library contains material that wildly varies across the quality spectrum. However, it is obvious that Philip put a large quantity of time, effort, and care into this book and offers over 200 pages of in-depth discussion and examples for automating a wide swath of data center activities.Each walk-through is arranged into a recipe, containing details on what will be required to follow along with the recipe, steps required to build the code, details on why the code is setup the way it is (and how to modify it for your own purposes). The author has frequently added additional reading to the recipes with blog links, documentation, KBs, and other handy resources.Of note, Philip has built a fairly robust set method for balancing share allocations and resource pools using some of my older work as a baseline. Don't worry, he pinged me about it before it made it into the book, but his approach of using a custom attributes (page 140) is refreshing and looks solid. He even writes a proper function whereas my code was just a spitball idea.There's also an entire section on snapshot management (page 107) with the steps necessary to build a snapshot management module (page 129). I've talked about PowerShell modules recently, and it's spectacular to see examples on building custom modules in this book. Philip offers ideas around naming of snapshots, when to quiesce memory, and how to automate / prune the snapshot lifecycle. This is solid stuff.The last thing I'll compliment is the points in the book where Philip goes a bit out of scope of a straight cookbook. For example, on page 78 there's a decent volume of content covering the use of Get-View and how to view properties and methods. That's some pretty advanced stuff, but the writing breaks it down into meaningful and digestible chunks. Having hit the limitation of the native PowerCLI cmdlets frequently, there's definitely a lot of value in knowing how to leverage methods directly.If you're brand new to PowerCLI, or looking to leverage some polished examples to help tickle the noodle on coding ideas, I'd suggest picking up a copy of PowerCLI Cookbook. I read the whole thing over the course of a few plane flights because it was that good.Note: I requested a review copy of the book from the author which was fulfilled by the publisher.
Amazon Verified review Amazon
Earl Waud Apr 06, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I am a virtualization engineer with 9 years of experience creating automation and administration solutions for large corporations.Last year I was contacted by Packt Publishing and asked if I would be interested in providing technical review services for a new book titled PowerCLI Cookbook. It seemed like an excellent opportunity and I quickly agreed.They sent me a draft copy of the book, one chapter at a time. I would review the chapter content for technical accuracy and test each of the chapter’s code samples and downloadable content, and reply with any corrections, my comments and any feedback. I quickly realized that reading a technical book is a lot different than reviewing a technical book. However I still enjoyed the process as It gave me a chance to use (and expand) my skills in a fun new way.Chapter by chapter, I reviewed the book. I found each chapter to be filled with powerful examples, showing ways to simplify and automate the real tasks that vSphere administrators need to do, the real tasks that I need to do. I finished my review of the last chapter back in early November .Well, Packt has finally published the PowerCLI Cookbook.They wanted to give the author time to validate and update the book’s content to include the vSphere 6 feature set.With a published copy in hand, and based on my detailed review of the book’s content, I can tell you with confidence that Philip Sellers has delivered an excellent resource on PowerCLI, and I highly recommend it to anyone looking for such a resource.The book details examples of dozens of highly useful, real world tasks needed for the day-to-day administration of your vSphere environment. The examples are presented in a way that lets your quickly learn to use and adapt them to your needs.Whether you are new to PowerCLI and looking for a book to help you learn and get started, or you are an experienced PowerShell or PowerCLI user looking for a great reference book to help you automate the administration of your virtual environment, you will find this book to be an excellent choice.
Amazon Verified review Amazon
R. Hudson Apr 09, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I’m glad I purchased this book! I’ve already found several topics that I’ve needed to get into my production routine. The book is put together very well with straight forward approaches covering what I and many administrators need every day for administration. Scripting and automation are life savers (no longer optional, but required). I believe I’ve already recouped my investment by just using the recipes presented and I’ve only just begun.
Amazon Verified review Amazon
Vinay Jun 05, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A great reference book to help you automate the administration of your virtual environment!! Grab it now....
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.