billyjoel
Enthusiast
Enthusiast

get template size

Jump to solution

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

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

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

Template Size

0 Kudos
LucD
Leadership
Leadership

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

billyjoel
Enthusiast
Enthusiast

Thank you sir LucD

0 Kudos