VMware Cloud Community
ajohn24
Contributor
Contributor
Jump to solution

How to get the details within an expression

Hi All,

Just starting with vsphere powerCLI again and wanted to understand the basics of hash arrays. I was executing the following command as below:

Get-VM VM1 | Get-View | Select-Object Name, @{N="ToolsVersion";E={$_.config.tools.toolsVersion"}}

and wanted to understand:

1. Am I correct assuming that by this we are creating a new property object Toolsversion?

2. How can i retrieve all the values that are at my disposal? Precisely, i want to ask where did this expression come from, E=$_.config.tools.toolsVersion, and how to find all the expressions that are available to create new properties.

Thx,

AJ

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

1. Yes, the Select-Object cmdlet will produce a new object, on that object you have a new property called ToolsVersion

You can see this by piping the result to the Get-Member cmdlet.

2. With the Get-View cmdlet you get the vSphere object from the .Net object.

These vSphere objects are described in the VMware vSphere API Reference

In this particular case you can check the VirtualMachine object.


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

View solution in original post

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

1. Yes, the Select-Object cmdlet will produce a new object, on that object you have a new property called ToolsVersion

You can see this by piping the result to the Get-Member cmdlet.

2. With the Get-View cmdlet you get the vSphere object from the .Net object.

These vSphere objects are described in the VMware vSphere API Reference

In this particular case you can check the VirtualMachine object.


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

Reply
0 Kudos