Automation

 View Only
  • 1.  Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 11:15 AM

    Hello,

    I try to find some help to get the Guest OS not the configured OS for each vm which have a snapshot.

     

    Get-VM | Get-Snapshot |

    select Name,

    Created,

    @{N="RunningOS";E={

    $s = Get-View -Id $_.ExtensionData.Guest.GuestFullName -Property GuestFullName

    while($s -and $s -isnot [vmview.guest.guestfullname]){

    $s = Get-View -Id $s.GuestFullName -Property GuestFullName

    }

    if($s){

    $s.GuestFullName

    }

    }},

     

    regards,

    David

     



  • 2.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 01:11 PM

    Did you try with



  • 3.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 01:23 PM

    Hello LucD,

    Your proposition is not working.

    I try with

    #$s = Get-Vm | Get-View -Property "Guest.GuestFullName

    #while($s -and $s -isnot [vmview.Guest.GuestFullname]){

    # $s = select -Property Guest.GuestFullName

    # }

    # if($s){

    # $s.GuestFullName

    #}

    #}},

     

    but not works also I think Get-view is not appropriate in my case. I'm lost for the moment



  • 4.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 01:39 PM

    In the snippet I posted I didn't use Get-View, but ExtensionData.
    The snippet in your last reply is all commented out.
    Not sure what the meaning of that last reply is.



  • 5.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 01:46 PM

    Hello,

    I'm sorry LucD I forgot to remove # on each line when I reply on this post but without it's always not working.

    If I understand your last reply I have to found the right extension data. because your proposition with Guest.GuestFullName is not working. When I extracted  data for runningOS is blank.



  • 6.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 01:54 PM

    Even when you remove the comments , that is not what I posted



  • 7.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 02:00 PM

    Hello LucD,

     

    when I tried:

    Get-VM | Get-Snapshot |
    select Name,Created,@{N="RunningOS";E={$_.ExtensionData.Guest.GuestFullName}}

    or

    Get-VM | Get-Snapshot |
    select Name,Created,@{N="RunningOS";E={$_.ExtensionData.Config.GuestFullName}}

    None data appear on RunningOS column



  • 8.  RE: Try to get the Guest OS in a snapshot inventory
    Best Answer

    Posted Jan 17, 2022 02:03 PM

    My bad, that should start from the VM property.



  • 9.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 02:11 PM

     LucD,

    It's working now. It's exactly that I would like.

    Thanks a lot



  • 10.  RE: Try to get the Guest OS in a snapshot inventory

    Posted Jan 17, 2022 02:17 PM

    You might want to mark the thread as answered, which makes it easier for others to find threads that have an answer.