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
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
Start with the Get-Member cmdlet.
Get-VM <guest> | Get-Member
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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
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
Thanks Luc...you are the man!....this is truly PowerCLI 101
Now let me get to reading the links that you have provided.
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
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...
>>$myvm = Get-VM VmName
>>$myvm.HITTABKEY
And just keep hitting the tab key to cycle through the methods and properties.