vSphere PowerCLI Reference

New-Template

Synopsis

Creates a new virtual machine template.

Syntax

New-Template [-VM] <VirtualMachine> [-Name] <String> [-Location] <VIContainer> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]
New-Template [[-Name] <String>] [-Location] <VIContainer> -VMHost <VMHost> [-Datastore <Datastore>] [-DiskStorageFormat <VirtualDiskStorageFormat>] -Template <Template> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]
New-Template [[-Name] <String>] [-Location] <VIContainer> -VMHost <VMHost> [-TemplateFilePath] <String> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-Template
Remove-Template
Set-Template

Detailed Description

Creates a new template based on the specified virtual machine. On VirtualCenter 2.0 and VirtualCenter 2.5, the virtual machine must be powered off before creating a template based on it. On VirtualCenter 2.5 Update 2, the virtual machine can be powered off or powered on, but not suspended. You can also create a new template by cloning an existing one.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
NameStringSpecify a name for the new template.truefalse
TemplateFilePathStringSpecify the datastore path to the file you want to use to to register the new template.truefalse
VMVirtualMachineSpecify the virtual machine from which you want to create the new template.truetrue (ByValue)
LocationVIContainerSpecify the location where you want to place the new template.truetrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse$true
DatastoreDatastoreSpecify a datastore where you want to store the new template.falsefalse
DiskStorageFormatVirtualDiskStorageFormatSpecify the disk storage format of the new template. The valid values are Thin and Thick.falsefalse
RunAsyncSwitchParameterIndicate that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the -RunAsync parameter run " help About_RunAsync" in the vSphere PowerCLI console.falsefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
TemplateTemplateSpecify a template you want to clone.falsetrue (ByValue)
VMHostVMHostSpecify the host where you want to create the new template.falsefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

Template

Notes

Examples

-------------- Example 1 --------------

New-Template -VM VM -Name Template -Location Datacenter

Creates a template named Template from the VM virtual machine on the Datacenter datacenter.

-------------- Example 2 --------------

New-Template -Name Template -TemplateFilePath "[Storage1] templatefolder/template.vmtx" -Location VMFolder -VMHost Host

Register a template to an inventory folder by using the specified template file.


Copyright © 1998 - 2011 VMware, Inc. All rights reserved.