Home > Net >  Empty Value does not return
Empty Value does not return

Time:02-04

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.

CodePudding user response:

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

CodePudding user response:

You're looking for the "Guest" property I think. FYI you can also do this to view everything if you're not sure of the exact name

Get-VM |
Select-Object -Property * |
Out-gridview
  •  Tags:  
  • Related