VMware Cloud Community
TimothyGaray
Contributor
Contributor
Jump to solution

VirtualMachine Details

I am new to PowerCLI and PowerShell. I have tried to go through the API list but am having trouble with (what I think should be a simple thing) coming up with details about a given VM.

If I write a script that identifes all the $vm objects on a specific host, what properties are available on that object? I've identified so far $vm.name and $vm.id

Is there a script out there already that will list all the details about a specific VM? This would help me to see what kind of information is available.

Thanks!

-Tim

0 Kudos
1 Solution

Accepted Solutions
Zsoldier
Expert
Expert
Jump to solution

I've found the easiest when starting out is to explore your actual objects. You can explore your available properties of VM's like this:

$vm = Get-VM vmname | get-view

Then type $vm

You'll then get a return of all the properties available. To dig further just type:

$vm.

then hit tab or type a property name that you saw from when you typed $vm

for example

$vm.summary

so forth and so on.

K. Chris Nakagaki (Zsoldier)

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier

View solution in original post

0 Kudos
6 Replies
NTurnbull
Expert
Expert
Jump to solution

Hi Tim, there are loads of great sites out there, have you seen this one ? Great code snippets and scripts, particularily like the daily health report

Thanks,

Neil

Thanks, Neil
Zsoldier
Expert
Expert
Jump to solution

I've found the easiest when starting out is to explore your actual objects. You can explore your available properties of VM's like this:

$vm = Get-VM vmname | get-view

Then type $vm

You'll then get a return of all the properties available. To dig further just type:

$vm.

then hit tab or type a property name that you saw from when you typed $vm

for example

$vm.summary

so forth and so on.

K. Chris Nakagaki (Zsoldier)

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
TimothyGaray
Contributor
Contributor
Jump to solution

Thank you. That does look like a good site. I am trying out that report right now...

Hi Tim, there are loads of great sites out there, have you seen this one ? Great code snippets and scripts, particularily like the daily health report

Thanks,

Neil

0 Kudos
TimothyGaray
Contributor
Contributor
Jump to solution

Wow! This is great! I assume I could use this same thing on other objects like hosts?

I've found the easiest when starting out is to explore your actual objects. You can explore your available properties of VM's like this:

$vm = Get-VM vmname | get-view

Then type $vm

You'll then get a return of all the properties available. To dig further just type:

$vm.

then hit tab or type a property name that you saw from when you typed $vm

for example

$vm.summary

so forth and so on.

K. Chris Nakagaki (Zsoldier)

http://tech.zsoldier.com

0 Kudos
Zsoldier
Expert
Expert
Jump to solution

Yup, exactly. I focused on hosts in a post that explains this idea.

http://tech.zsoldier.com/2009/09/exploring-vmware-api-using-powercli-get.html

K. Chris Nakagaki (Zsoldier)

http://tech.zsoldier.com

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
TimothyGaray
Contributor
Contributor
Jump to solution

Thank you so much! I found exactly the value I was looking for ($vm.MoRef.Value).

-Tim

0 Kudos