Automation

 View Only
  • 1.  get template size

    Posted May 21, 2020 08:24 PM

    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?



  • 2.  RE: get template size

    Posted May 21, 2020 08:32 PM

    well already found this from 2010 by Lucd :smileyhappy: it works fine

    Template Size



  • 3.  RE: get template size
    Best Answer

    Posted May 21, 2020 08:34 PM

    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)}}



  • 4.  RE: get template size

    Posted May 21, 2020 08:40 PM

    Thank you sir LucD