New-Template
This cmdlet creates a new template based on the specified virtual machine. You can also create a new template by cloning an existing one. You can also register an existing template to the vCenter Server inventory.
Syntax
[-Location] <VIContainer>
-Name <String>
[-Datastore <StorageResource>]
[-RunAsync]
[-Server <VIServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
VirtualMachine | 1 |
|
Specifies the virtual machine from which you want to create the new template. | required |
|
VIContainer | 2 |
|
Specifies the location where you want to place the new template. | required |
|
String | named |
|
Specifies a name for the new template. | optional |
|
StorageResource | named |
|
Specifies the datastore or the datastore cluster where you want to store the new template. | optional |
|
SwitchParameter | named |
|
Indicates 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 VMware PowerCLI console. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. |
-Template <Template>
-VMHost <VMHost>
[-Datastore <StorageResource>]
[-DiskStorageFormat <VirtualDiskStorageFormat>]
[-Name <String>]
[-RunAsync]
[-Server <VIServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
VIContainer | named |
|
Specifies the location where you want to place the new template. | required |
|
Template | named |
|
Specifies a template you want to clone. | required |
|
VMHost | named |
|
Specifies the host where you want to create the new template. | optional |
|
StorageResource | named |
|
Specifies the datastore or the datastore cluster where you want to store the new template. | optional |
|
VirtualDiskStorageFormat | named |
|
Specifies the disk storage format of the new template. This parameter accepts Thin, Thick, and EagerZeroedThick values. | optional |
|
String | named |
|
Specifies a name for the new template. | optional |
|
SwitchParameter | named |
|
Indicates 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 VMware PowerCLI console. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. |
-Location <VIContainer>
-VMHost <VMHost>
[-Name <String>]
[-RunAsync]
[-Server <VIServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
String | 1 |
|
Specifies the datastore path to the file you want to use to register the new template. | required |
|
VIContainer | named |
|
Specifies the location where you want to place the new template. | required |
|
VMHost | named |
|
Specifies the host where you want to create the new template. | optional |
|
String | named |
|
Specifies a name for the new template. | optional |
|
SwitchParameter | named |
|
Indicates 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 VMware PowerCLI console. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. |
Output
VMware.VimAutomation.ViCore.Types.V1.Inventory.Template
Examples
Example 1
Creates a template named MyTemplate from the MyVM1 virtual machine and stores it in the MyDatastoreCluster datastore cluster in the Datacenter2 datacenter.
Example 2
Registers the existing MyTemplate1 template to a vCenter Server inventory folder by using the specified template file.
Example 3
Creates the MyTemplate2 template by cloning an existing template and stores the new template in the specified datastore in the Datacenter2 datacenter.
Related Commands