VMware Cloud Community
mtrohde
Enthusiast
Enthusiast

Looking for PowerCli Get-View property list?

I have looked around without success for a list of all the properties of a VM I can query with Get-View cmdlet.  Here is a sample script of some of the things I know about.

Get-VM | Sort-Object -Property Name |

Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName", "Config.Hardware.MemoryMB", "Config.hardware.NumCPU", "Guest.Hostname") |

Select -Property Name,

@{N="Configured OS";E={$_.Config.GuestFullName}},

@{N="Running OS";E={$_.Guest.GuestFullName}},

@{N="Configured Mem";E={$_.Config.Hardware.MemoryMB}},

@{N="Num Configured CPU";E={$_.Config.hardware.NumCPU}},

@{N="DnsName"; E={$_.Guest.Hostname}}|

What else is there?

Michael

6 Replies
jpsider
Expert
Expert

try this to get a full list about a VirtualMachine:

get-view -viewtype VirtualMachine

or

get-view -viewtype VirtualMachine | get-member

0 Kudos
mtrohde
Enthusiast
Enthusiast

jpsider thanks for taking the time to reply but that isn't what I am looking for.  I want to be able to create scripts to report on information for VMs and have that data go to an excel.  The sample script I provided will do that but only for the VM parameters I entered.  I am looking for a complete list of what properties I can script with.

0 Kudos
jpsider
Expert
Expert

Yes, exactly, you are going to need to use get-view to explore the API. There are Tons of things you can report on. The command I gave you are a start.

Next step....

$myvm = "somename"

$VM = get-view –viewtype VirtualMachine –filter @{“Name”=”$myvm”}


$vm.config


or


$vm.guest


You will get tons of information.


ref: Get-View Part 1: Introduction to Get-View - VMware PowerCLI Blog - VMware Blogs


0 Kudos
LucD
Leadership
Leadership

You can consult the VirtualMachine object properties in the API Reference Guide.


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

Gairc17
Enthusiast
Enthusiast

To get able to drill down at select information about a VM guest info for example would it look something like this

{$vm.guest.hostname} ?

0 Kudos
LucD
Leadership
Leadership

Correct


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