VMware Cloud Community
AGFlora
Enthusiast
Enthusiast
Jump to solution

What is the best way to find methods and properties for any given object?

HI

I'm a noob to PowerCLI but I'm learning it little by little as I go along. I'm hoping that one day that light bulb will go off in my head and I'll say "wow...this all makes sense to me now!"

Until then can some one direct me to the best way to to find methods and properties for any given object?

I've tried the MOB, and the SDK doc. which by the way were not too much helpful (maybe because I'm such a noob?)

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

And for the (configuration) properties of the managed objects in the SDK have a look at TA2650 scripts – Part 1 – Profiling your vSphere environment.

There is a sample how to use the XML file in TA2650 scripts – Part 2 – Using the profile XML file for SDK programming


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

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

Start with the Get-Member cmdlet.

Get-VM <guest> | Get-Member


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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

And for the (configuration) properties of the managed objects in the SDK have a look at TA2650 scripts – Part 1 – Profiling your vSphere environment.

There is a sample how to use the XML file in TA2650 scripts – Part 2 – Using the profile XML file for SDK programming


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

0 Kudos
AGFlora
Enthusiast
Enthusiast
Jump to solution

Question:

I piped the Get-cddrive cmdlet to the Get-Member cmdlet but did not see the $._ConnectionState.StartConnected property (or is it a method?)

How would I go about finding properties or methods like the one mentioned above?

Thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That's because the ConnectionState property is an object of type ConnectInfoImpl.

This is the view of the CDDriveImpl object

To list the actual ConnectInfoImpl object you could use this trick

This can be scripted as well.

In fact the script in the 1st link above does just that.


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

AGFlora
Enthusiast
Enthusiast
Jump to solution

Thanks Luc...you are the man!....this is truly PowerCLI 101 Smiley Happy

Now let me get to reading the links that you have provided.

0 Kudos
halr9000
Commander
Commander
Jump to solution

I also go over a lot of information about the members in my book, you may want to check that out.

[vExpert|http://www.vmware.com/communities/vexpert/], PowerShell MVP, VI Toolkit forum moderator

Author of the book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
bradley76
Contributor
Contributor
Jump to solution

Another (kind of fun) way to see what's available to you on a given object is to set the object to a variable, and then dot-tab through the available methods and properties.

For example...

&gt;&gt;$myvm = Get-VM VmName

&gt;&gt;$myvm.HITTABKEY

And just keep hitting the tab key to cycle through the methods and properties.

0 Kudos