Wiley.com
Print this page Share

VMware vSphere PowerCLI Reference: Automating vSphere Administration

ISBN: 978-0-470-89079-0
Paperback
768 pages
April 2011
VMware vSphere PowerCLI Reference: Automating vSphere Administration (0470890797) cover image
This product is not currently available for purchase from this website.
For customer care, special sales, or to find your rep, please visit our Contact Us page.

Forewords xix

Introduction xxi

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

Chapter 1 Automating vCenter Server Deployment and Configuration 3

Prepare the vCenter Installation 4

Create an Automated Installation 5

Set Up Your vCenter Folder Structure 8

Creating a Folder Structure from Scratch 8

Exporting a Folder Structure 11

Importing a Folder Structure 14

Define Users and Their Privileges 15

Granting Privileges 15

Creating New Roles 19

Bringing in Users 21

Exporting Permissions 22

Importing Permissions 24

Configure Datacenters and Clusters 26

Creating Datacenters 27

Creating Clusters 27

Configuring High Availability 27

Configuring Distributed Resource Scheduler 28

Configuring Enhanced vMotion Compatibility 29

Configuring Distributed Power Management 29

Licensing 31

Viewing License Information 31

Licensing a Host 33

Chapter 2 Automating vSphere Hypervisor Deployment and Configuration 35

Prepare for an Installation 36

The Installation Medium 36

Gathering Required Software 37

Automate an Installation 37

Customizing an Installation with Kickstart 38

Postinstallation Configuration 43

Chapter 3 Automating Storage and Networking 67

Set Up the Storage 68

Setting Up Different Types of Storage 68

Configuring an iSCSI Target 69

Rescanning for New Storage 70

Adding Datastores 70

Setting a Multipath Policy 77

Set Up the Network 78

Standard and Distributed Switches 78

Adding VMkernel Port Groups 83

Making Your Switches and Port Groups Resilient 84

Copying Networking Configuration from Another Host 86

Moving Multiple VMs to a New Port Group 89

Chapter 4 Using Advanced vSphere Features 93

Manage vNetwork Distributed Switches 94

Use Fault Tolerance 105

Configure Storage I/O Control 106

Use Distributed Power Management 113

Configure Host Profiles 117

Configure Active Directory Integration 120

Part II Managing the Virtual Machine Life Cycle 127

Chapter 5 Creating Virtual Machines 129

Use the New-VM Cmdlet 130

Creating a New Virtual Machine 131

Cloning a Virtual Machine 136

Deploying from a Template 137

Registering a Virtual Machine 139

Use the SDK 143

Perform a Mass Deployment 150

Preparing for Mass Deployment 151

Running the Deployment Synchronous or Asynchronous 152

Postconfiguration and Validating the New Virtual Machines 154

Identify Eye-Catchers for Auditing 157

Using Custom Attributes 157

Maintaining Custom Attributes 159

Maintain VMware Tools 163

Windows Silent Install 164

Linux Silent Install 165

Updating VMware Tools 170

Chapter 6 Using Templates and Customization Specifications 173

Use Customization Specifications 174

Creating Customization Specifications 174

Managing Customization Specifications 175

Using Customization Specifications 177

Use Templates 178

Creating Templates 178

Deploying Guests from Templates 179

Maintaining Templates 185

Chapter 7 Configuring Virtual Machine Hardware 197

Add, Configure, and Remove Virtual Hardware 198

Changing Virtual Memory 198

Changing Memory Resources 199

Changing the Number of vCPUs 201

Changing vCPU Resources 203

Adding or Removing a Network Adapter 205

Assigning a Network 207

Adding a Virtual Disk . 208

Removing a Virtual Disk 211

Extending a Virtual Disk 218

Changing Other Hardware 221

Optimize Storage Usage with Thin Provisioning 223

Converting a Virtual Disk Using Storage vMotion 224

Converting a Virtual Disk in Place 224

Chapter 8 Advanced Virtual Machine Features 229

Interact with the Guest OS 230

Using Linux Native Tools 231

Using Windows Native Tools 235

Using PowerCLI Methods 245

Use vMotion and Storage vMotion 250

Examining vMotion Requirements 250

Moving a Virtual Machine 251

Use and Manage Snapshots 256

Creating and Removing Snapshots 257

Maintaining Snapshots 258

Restricting the Creation of Snapshots 264

Chapter 9 Using vApps 269

Import Virtual Appliances 270

Create Your Own vApps 272

Maintain vApps 274

Setting the Start Order 274

Using IP Pools 282

Using IP Assignment 293

Modifying vApp Product Information 296

Part III Securing Your vSphere Environment 301

Chapter 10 Backing Up and Restoring Your Virtual Machines 303

Work with Snapshots 304

Create Do-It-Yourself Backups 304

Restore Your VMs from a DIY Backup 307

Change Block Tracking 308

Checking CBT Status 309

Enabling/Disabling CBT 309

Use Site Recovery Manager 311

Automating SRM Using PowerShell Functions 311

Customizing Recovery Plans 312

Provide PowerShell Support for Corporate Backup Applications 315

Quest 316

Veeam 320

Chapter 11 Organize Your Disaster Recovery 325

Back Up Your vCenter Server 326

Backing Up Your vCenter Server Database 327

Backing Up Your vCenter Server Configuration 333

Restore Your vCenter Server 336

The Restore Sequence 336

Restoring Your vCenter Server Database 337

Reconnecting ESX Hosts 340

Export vCenter Server Inventory Items 344

Folders 345

Datacenters 347

Clusters 349

Roles 350

Permissions 351

VM Locations 352

Hosts 352

Import vCenter Server Inventory Items 353

Folders and Datacenters 353

Datacenter Folders 354

Clusters 355

Hosts 356

VM Locations 357

Roles 358

Permissions 358

Recover Virtual Machines 360

Chapter 12 Hardening the vSphere Environment 367

Use the Hardening Guide 368

Work with the Guidelines 369

Virtual Machines 369

ESX(i) Hosts 375

vNetwork 394

vCenter Server 399

COS 399

Bring It All Together 401

Chapter 13 Maintain Security in Your vSphere Environment 403

Install the vCenter Update Manager PowerCLI Snap-in 404

Work with Baselines 406

Creating a Baseline 406

Updating a Baseline 410

Attaching and Detaching Baselines 411

Work with Upgrades and Patches 412

Scanning a Host 412

Staging Patches to a Host 413

Remediating a Host 414

Including Patching as Part of Host Deployment 416

Countering the Self-Aware Update Manager 417

Report the Security Status 419

Understanding Datacenter Compliance 419

Implementing Specific Baseline Compliance 422

Implementing Required Patches 424

Part IV Monitoring and Reporting 427

Chapter 14 Reporting the Status of Your vSphere Environment 429

Determine What to Report 430

Virtual Machines 430

Guest Operating Systems 436

Hosts 438

Clusters 445

Customize Your Reports 450

Adding Properties to Existing Objects 450

Creating Custom Objects 452

Exporting Output 453

Chapter 15 Using Statistical Data 463

Understand Some Basic Concepts 464

What Does vCenter Server Add? 464

Historical Intervals 468

Statistics Levels 470

Metrics 473

Instances 479

Gather Statistical Data 482

The Cmdlets 483

What Is in the Statistical Data? 483

Know Which Metrics to Use 485

Techniques 486

Offload Statistical Data 499

Chapter 16 Monitoring the vSphere Environment 501

Determine What to Monitor 502

Use Alarms 503

Designing an Alarm 503

Removing Alarms 524

Modifying Alarms 525

Moving Alarms 526

Chapter 17 Auditing the vSphere Environment 529

Understand Tasks and Events Data 530

Report the PowerCLI Way 535

What Does Get-VIEvent Return? 535

Using the Get-VIEvent Cmdlet 537

Report the SDK Way 543

Why Use the SDK API? 544

What Is a Collector? 544

Fitting Collectors into Your Script 544

Sample Scripts 551

Configure Tasks and Events Retention 554

Part V Scripting Tools and Features 561

Chapter 18 Scheduling Automation Scripts 563

Use the vCenter Server Scheduler 564

Creating vCenter Server Scheduled Tasks 564

Reporting on vCenter Server Scheduled Tasks 567

Use the Windows Scheduler 569

Scheduling Scripts on Windows 570

Dealing with PowerCLI Issues When Scheduling Scripts 571

Working with the Scheduled Tasks Module 576

Chapter 19 The SDK 583

Work with the vSphere SDK 584

Use the vSphere API Reference 586

Setting a Host in Maintenance Mode 588

Did the Alarm Fire the SNMP Trap? 589

Finding Metrics for Thin Provisioning 590

Can You Migrate This Guest? 592

Use Managed Objects 596

Managed Object Types 597

Data Objects and Their Methods 600

Using vSphere Managers 603

Managed Object References 605

Code Parameter Objects 609

Find the Method You Need 610

Changing the Boot Delay of a Virtual Machine 611

Finding the Patches Installed on an ESX Host 612

Finding the Host HWuptime 613

Changing the vCenter Logging Options 614

Understand Return Values and Faults 615

Put Some Tips and Tricks to Good Use 618

Waiting for an Asynchronous Task 618

Better Error Handling after Asynchronous Tasks 619

Finding Service Managers with Get-View Shortcuts 619

Chapter 20 The Onyx Project 621

Work with the Onyx Project 622

Let Onyx Help You 622

Use Onyx 623

Connecting to a vCenter or an ESX(i) Server 623

Translating Captured SOAP Traffic 626

Configuring Onyx 626

Using Onyx Output 630

Work with References 632

Hard-Coded References to Entities 633

Hard-Coded MoRefs 633

Use Onyx in the Real World 633

Chapter 21 PowerGUI and vEcoShell 635

Understand GUI Environments in Managing Automation 636

Use PowerPacks to Manage Automation Scripts 637

Making a Connection to vCenter Server 639

Working with Links and Actions 642

Using the VMware PowerPack for Reporting 646

Using the VMware PowerPack for Administration Tasks 650

Importing the VMware Community PowerPack 653

Creating a PowerPack 658

Chapter 22 PowerWF Studio 663

Understand PowerWF Studio’s Capabilities 664

Integrate PowerWF Studio 665

Use PowerCLI in PowerWF Studio 665

Graphical Flow 666

Script Editor 667

Use a Workflow 668

Create Typical Workflows 671

Creating New Guests from the DOS Prompt 671

Creating a Log Viewer Using PowerWF Studio 675

Register-VMX as a Windows Application 682

Bringing It All Together 683

Chapter 23 Add a GUI Front-End to Your Automation Scripts 687

Appreciate the Value of a GUI 688

Choose the Correct Tool 688

Create Some Basic WinForms 690

The Form Modes 691

Adding a Control 692

Using a Script Layout Template 695

Adding List Boxes 697

Adding Radio Buttons 701

Create a Somewhat Advanced Example 704

Index 715

Back to Top