Book Image

Learning PowerCLI for VMware VSphere

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI for VMware VSphere

By: Robert van den Nieuwendijk

Overview of this book

Table of Contents (17 chapters)
Learning PowerCLI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Converting a virtual machine into a template


You have already learned how to deploy a virtual machine from a template. You now need to know how to create a template. You begin with creating a virtual machine and installing the operating system and application software and patches that you need for all of the virtual machines that you want to deploy. After you are finished creating your new virtual machine, you have to convert it into a template using the Set-VM cmdlet, which you have already seen in the previous section. Let's convert the VM1 virtual machine into a template:

PowerCLI C:\> Get-VM -Name VM1 | Set-VM -ToTemplate -Confirm:$false

The output to the preceding command is as follows:

Name
----
VM1

To confirm that VM1 is now a template, you can use the Get-Template cmdlet to view all of the templates:

PowerCLI C:\> Get-Template

The output to the preceding command is as follows:

Name
----
VM1

The Get-Template cmdlet has the following syntax:

Get-Template [-Location <VIContainer...