How to Move a Template
I was surprised this morning to find that you can't directly move templates using the existing cmdlets. Looks like you can either a) change template to a VM using set-template or b) use Get-View on a Folder object and then call its MoveIntoFolder method.
Method A - there and back again
$vm = Get-Template wind* | Set-Template -ToVM | Move-VM -Destination (Get-Folder templates) $vmView = $vm | Get-View $vmView.MarkAsTemplate()
TotalSeconds : 8.9222029
Method B - do it folder style
This one should be much faster...let's see:
$TmplView = Get-Template wind* | Get-View $FolderView = Get-Folder Templates | Get-View $FolderView.MoveIntoFolder( $TmplView.MoRef )
TotalSeconds : 2.0466224
We have a winner ![]()
Note that the timing was performed on my home lab. I imagine on nice hardware method B would take less than a second.