Here's my how I'm retrieving the power state -
$snap_vm = Get-VM
foreach($vmname in $snap_vm)
{
$VM_Snapshot = Get-Snapshot -VM $vmname | Where-Object {$_.Created -lt (Get-Date).AddDays(-3)}
foreach($Snapshot in $VM_Snapshot)
{
$snap_name = $Snapshot.name.replace('%2f','/').replace('%252f','/')
Write-Output $snap_name
$snap_VM = $Snapshot.VM
$snap_Created = $Snapshot.Created
$snap_Description = $Snapshot.Description
$snap_status=$Snapshot.PowerState # I maanged to make it work
$snap_cluster = # please tell me how to get the snapshot's cluster it belongs to
$snap_os = # how to get the snapshot's os
You could do something like this
$snap_cluster = (Get-Cluster -VM $snapshot.VM).Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
(Get-VMGuest -VM $Snapshot).OSFullName doesn't work though 😞
You could do something like this
$snap_cluster = (Get-Cluster -VM $snapshot.VM).Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you for answering. I'd appreciate helping me get the operating system?
(Get-VMGuest -VM $Snapshot).OSFullName doesn't work though 😞
Try with
(Get-VMGuest -VM $Snapshot.VM).OSFullName
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference