copy templates!
[powershell]
Connect-VIServer *
$st = nas
$fold = "Nas_Templates"
$datasto = "z) nasvm01*"
$ho = "nasvm01*"
$spec = New-Object VMware.Vim.VirtualMachineCloneSpec
$folder = (Get-Folder $fold | Get-View)
$data = (Get-Datastore $datasto | Get-View)
$hos = (Get-VMHost $ho | get-view)
#$folder = New-Object VMware.Vim.ManagedObjectReference
#$folder.type = "Folder"
#$folder.value = "group-v12744"
$spec.location = New-Object VMware.Vim.VirtualMachineRelocateSpec
$spec.location.datastore = New-Object VMware.Vim.ManagedObjectReference
$spec.location.datastore.type = "Datastore"
$spec.location.datastore.value = $data.moref.value
$spec.location.host = New-Object VMware.Vim.ManagedObjectReference
$spec.location.host.type = "HostSystem"
$spec.location.host.value = $hos.moref.value
$spec.location.transform = "sparse"
$spec.template = $true
$spec.powerOn = $false
$_this = Get-View -Id ‘VirtualMachine-vm-12257’
$_this.CloneVM_Task($folder.moref, "_nas_template_2008_STD32", $spec)
$_this = Get-View -Id ‘VirtualMachine-vm-12259’
$_this.CloneVM_Task($folder.moref, "_nas_template_2003_STD32", $spec)
$_this = Get-View -Id ‘VirtualMachine-vm-12348’
$_this.CloneVM_Task($folder.moref, "_nas_template_2008R2_STD", $spec)
$_this = Get-View -Id ‘VirtualMachine-vm-12697’
$_this.CloneVM_Task($folder.moref, "_nas_template_2008_STD64", $spec)
[/powershell]