VMware Cloud Community
markdjones82
Expert
Expert
Jump to solution

Get exact folder name on datastore for a template

All,

  So i'm pretty much there just missing a couple items.  I want to specify a specific datastore and get the template names and their folder locations on the datastore.

I have this command and it gives me the HD info, but doesn't correlate to the VM name.  How can i format this to get VM name matched with datastore location?

get-datacenter -name "Main  Data Center 1" | get-datastore "templates_isos" | get-template |Get-HardDisk

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

It's there, look at the Parent property

get-datacenter -name "Main  Data Center 1" | get-datastore "templates_isos" | get-template |Get-HardDisk | Select Name,Parent

In the default view you don't get to see all the preoperties that are there.

You can use the Get-Member cmdlet to see the available properties

get-datacenter -name "Main  Data Center 1" | get-datastore "templates_isos" | get-template |Get-HardDisk | Get-Member


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

It's there, look at the Parent property

get-datacenter -name "Main  Data Center 1" | get-datastore "templates_isos" | get-template |Get-HardDisk | Select Name,Parent

In the default view you don't get to see all the preoperties that are there.

You can use the Get-Member cmdlet to see the available properties

get-datacenter -name "Main  Data Center 1" | get-datastore "templates_isos" | get-template |Get-HardDisk | Get-Member


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

0 Kudos
markdjones82
Expert
Expert
Jump to solution

I did the get-member but didn't notice parent!  Luc always helpful in cleanin up my messes. Thanks again!

Here was my final command to get what i needed for anyone else intrested.

get-datacenter -name "Datacenter" | get-datastore "datastore" | get-template |Get-HardDisk | select Parent,Filename | Export-Csv -noTypeInformation folder_location.csv

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos