Template Category
Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations
Step 1: Retrieve a object by running a Get command
# Retrieves all virtual machine templates in the Datacenter datacenter, whose names start with "Web".
Get-Template -Name Web* -Location Datacenter
Step 2 : Run commands from the CRUD group
# Creates a template named MyTemplate from the MyVM1 virtual machine and stores it in the MyDatastoreCluster datastore cluster in the Datacenter2 datacenter.
$myVM = Get-VM -Name "MyVM1" $drsCluster=Get-DatastoreCluster "MyDatastoreCluster" New-Template -VM $myVM -Name "MyTemplate" -Datastore $drsCluster -Location Datacenter2
# Moves the $template object into the $dest container object.
Move-Template -Template $template -Destination $dest
# Removes the virtual machine template saved in the $template variable.
Remove-Template -Template $template
Step 3: Explore More Related Commands:
Set-Template | This cmdlet modifies the specified virtual machine template. |