powershellvsphere

Empty Value does not return


Get-VM |
    Select Name, Operatingsystem, VMHost, PowerState,
        @{N="Datastore"; E={$_ |
            Get-Datastore}} |
    Out-gridview

I ran this command. It will return and output a grid view with all rows filled in.

However, the field "OperatingSystem" returns a blank column, nothing there.


Solution

  • Untested, but I think you can do this:

    Get-VM | Select-Object Name, 
                           @{Name = 'Operatingsystem'; Expression = {$_.Guest.OsFullName}},
                           VMHost, PowerState,
                           @{Name = 'Datastore'; Expression = {$_ | Get-Datastore}} |
             Out-GridView