VMware Cloud Community
billyjoel
Enthusiast
Enthusiast
Jump to solution

get template size

Hi all,

I have the below script to get templates that recides in a specific datastore:

get-template -Location $vmhost | where-object{$_.extensiondata.config.files.VmPathName -like "*test_datastore1*"} | select name,

@{n='VMHOST';e={$vmhost.name}},

@{n='DS';e={$_.extensiondata.config.files.VmPathName.Split('[')[1].Split(']')[0]}}

how can I also get the entire size of the templates in GB?

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-Template -Location $vmhost | where-object{$_.extensiondata.config.files.VmPathName -like "*test_datastore1*"} | select name,

@{n='VMHOST';e={$vmhost.name}},

@{n='DS';e={$_.extensiondata.config.files.VmPathName.Split('[')[1].Split(']')[0]}},

@{N='Storage';E={[math]::Round($_.ExtensionData.Summary.Storage.Committed/1GB,2)}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

3 Replies
billyjoel
Enthusiast
Enthusiast
Jump to solution

well already found this from 2010 by Lucd Smiley Happy it works fine

Template Size

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-Template -Location $vmhost | where-object{$_.extensiondata.config.files.VmPathName -like "*test_datastore1*"} | select name,

@{n='VMHOST';e={$vmhost.name}},

@{n='DS';e={$_.extensiondata.config.files.VmPathName.Split('[')[1].Split(']')[0]}},

@{N='Storage';E={[math]::Round($_.ExtensionData.Summary.Storage.Committed/1GB,2)}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

billyjoel
Enthusiast
Enthusiast
Jump to solution

Thank you sir LucD

Reply
0 Kudos