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
My bad, that should start from the VM property.
Get-VM | Get-Snapshot |
select Name,Created,@{N="RunningOS";E={$_.VM.ExtensionData.Guest.GuestFullName}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you try with
Get-VM | Get-Snapshot |
select Name,Created,@{N="RunningOS";E={$_.ExtensionData.Guest.GuestFullName}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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.
Even when you remove the comments , that is not what I posted
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
My bad, that should start from the VM property.
Get-VM | Get-Snapshot |
select Name,Created,@{N="RunningOS";E={$_.VM.ExtensionData.Guest.GuestFullName}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
It's working now. It's exactly that I would like.
Thanks a lot
You might want to mark the thread as answered, which makes it easier for others to find threads that have an answer.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference