Where are virtual machine templates located ? datastore, folder, vmtx file

by Grzegorz Kulikowski

I was doing some host upgrades today, and had to migrate some stuff from one place to another. I had to also manually re register templates while doing this. So in order not to lose too much time on finding where are my templates in clusters i wrote myself this tiny line which helps in this situation.
[sourcecode language=”powershell”]
foreach($vmhost in get-cluster ‘your_cluster’|get-vmhost){get-template -Location $vmhost | select name,@{n=’VMHOST’;e={$vmhost.name}},@{n=’VMTX’;e={$_.extensiondata.config.files.VmPathName}}}

Name VMHOST VMTX
—- —— —-
Win_Template host1.local [DS01] TEMPLATE_win/Win_Template.vmtx
Win7_Template host2.local [DS02] TEMPLATE_win7/Win7_Template.vmtx
[/sourcecode]

Within VMTX property you will see the datastore name [datastore_name] then the directory in which the vmtx resides, and then the vmtx file name. There is not much i guess to explain in this short line. First i take all vmhosts in specific cluster, then i get list of templates for each host and display its name, vmhost name and the vmpathname.

Tiny, but helpful 😉

Advertisements

You may also like

2 comments

Tariq Khan April 25, 2018 - 5:04 pm

Good 1 liner – still relevant in 2018! I needed it today – Thank you!

Reply
psvmware April 25, 2018 - 8:09 pm

cheers for that. few days ago my colleague told me he his still using my auto provisioning robot from 2015 😉 that’s i guess what make a good code , good 😉

Reply

Leave a Reply

Chinese (Simplified)DutchEnglishFrenchGermanHindiPolishRussianSpanish