Syntax
New-Template [-VM] <VirtualMachine> [-Name] <String> [-Location] <VIContainer> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]Related Commands
Online versionDetailed 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
| Name | Type | Description | Required? | Pipeline Input | Default Value |
|---|---|---|---|---|---|
| Name | String | Specify a name for the new template. | true | false | |
| TemplateFilePath | String | Specify the datastore path to the file you want to use to to register the new template. | true | false | |
| VM | VirtualMachine | Specify the virtual machine from which you want to create the new template. | true | true (ByValue) | |
| Location | VIContainer | Specify the location where you want to place the new template. | true | true (ByValue) | |
| Confirm | SwitchParameter | If 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. | false | false | $true |
| Datastore | Datastore | Specify a datastore where you want to store the new template. | false | false | |
| DiskStorageFormat | VirtualDiskStorageFormat | Specify the disk storage format of the new template. The valid values are Thin and Thick. | false | false | |
| RunAsync | SwitchParameter | Indicate 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. | false | false | |
| Server | VIServer[] | 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. | false | false | |
| Template | Template | Specify a template you want to clone. | false | true (ByValue) | |
| VMHost | VMHost | Specify the host where you want to create the new template. | false | false | |
| WhatIf | SwitchParameter | Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false |
Return Type
TemplateNotes
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.