Book Image

VMware vCenter Cookbook

By : Kostantin Kuminsky
Book Image

VMware vCenter Cookbook

By: Kostantin Kuminsky

Overview of this book

Table of Contents (15 chapters)
VMware vCenter Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Scheduling the VM clone


The vCenter task scheduler discussed in the Automating tasks with scheduler recipe in Chapter 6, Basic Administrative Tasks, allows the automation of a lot of management tasks. At the same time, it has limitations. For example, it does not allow scheduling virtual machine clones, which may be necessary when a copy of a VM is needed.

In this, and similar situations, administrators can use Windows Task Scheduler to run the PowerShell script with PowerCLI commands.

Getting ready

Before creating and testing the following VM deployment script described, make sure that:

  • PowerCLI 5.8 or later is installed on the server, where the script will be executed

  • The user account that will be used has permissions to clone virtual machines

How to do it...

To accomplish the task, we will create the PowerShell script and schedule it in Windows Task Scheduler.

Creating the script

The PowerShell script to clone a VM consists of the following commands:

  1. Define variables used later in this script:

    ...