VMware Cloud Community
Pilu1978
Enthusiast
Enthusiast
Jump to solution

New To Powercli

Hi,

I am new to powercli and trying to explore it as much as possible. While working with powercli I do not know how to find property of the members of a cmdlet. For example  if I ran the following command on the powercli:

Get-VM | Get-Member

We will get a list of members. Now If I want use Powerstate member in my script I need to know that this memeber has two sub-properties as Poweredon and PoweredOff.

Now I do not know what are the properties of the member Guest or harddisks etc. So how to find these properties easily so that I can use it as a condition with where-object in my script.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can tackle this with the Format-Custom cmdlet.

Something like this will show you the properties 2 levels deep.

Get-VM MyVM | Format-Custom * -Depth 2

And if you're only interested in the Guest property, you could do

Get-VM MyVM | Format-Custom Guest -Depth 2


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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

You can tackle this with the Format-Custom cmdlet.

Something like this will show you the properties 2 levels deep.

Get-VM MyVM | Format-Custom * -Depth 2

And if you're only interested in the Guest property, you could do

Get-VM MyVM | Format-Custom Guest -Depth 2


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

0 Kudos