VMware Cloud Community
nava_thulasi39
Jump to solution

How to use Get-inventory?

Hi,

For some reason, I wanted to collect all the inventory details from the Datacenter. So thought using this cmdlet  - get-inventory..

As i don't know how to sort it using the type ( There is no type property to sort it out - maybe i am wrong). I used ID property to sort it out. But there is no difference for Virtual Machine and Template, So how can i differentiate using the ID property or how to sort it out using some other property?

Many thanks in advance.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can use a Where-clause and check the type.

Something like this

Get-Inventory | where {$_ -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.TemplateImpl]}

This will get you all templates


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You can use a Where-clause and check the type.

Something like this

Get-Inventory | where {$_ -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.TemplateImpl]}

This will get you all templates


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

0 Kudos
nava_thulasi39
Jump to solution

Hi LucD,

Thanks for the great tips.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos