PowerCLI

 View Only
  • 1.  Looking for PowerCli Get-View property list?

    Posted Jan 26, 2017 02:57 PM

    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



  • 2.  RE: Looking for PowerCli Get-View property list?

    Posted Jan 26, 2017 03:11 PM

    try this to get a full list about a VirtualMachine:

    get-view -viewtype VirtualMachine

    or

    get-view -viewtype VirtualMachine | get-member



  • 3.  RE: Looking for PowerCli Get-View property list?

    Posted Jan 26, 2017 05:35 PM

    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.



  • 4.  RE: Looking for PowerCli Get-View property list?

    Posted Jan 26, 2017 05:54 PM

    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




  • 5.  RE: Looking for PowerCli Get-View property list?

    Posted Jan 26, 2017 06:39 PM

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



  • 6.  RE: Looking for PowerCli Get-View property list?

    Posted Apr 22, 2020 07:59 PM

    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} ?



  • 7.  RE: Looking for PowerCli Get-View property list?

    Posted Apr 22, 2020 08:00 PM

    Correct