prabhushakti
Contributor
Contributor

How do I list our vcenter's snapshots os, poweron/off state and which cluster it belongs to.

Jump to solution

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
0 Kudos
2 Solutions

Accepted Solutions
LucD
Leadership
Leadership

You could do something like this

$snap_cluster = (Get-Cluster -VM $snapshot.VM).Name


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

prabhushakti
Contributor
Contributor

(Get-VMGuest -VM $Snapshot).OSFullName doesn't work though 😞

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership

You could do something like this

$snap_cluster = (Get-Cluster -VM $snapshot.VM).Name


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

prabhushakti
Contributor
Contributor

Thank you for answering. I'd appreciate helping me get the operating system?

0 Kudos
prabhushakti
Contributor
Contributor

(Get-VMGuest -VM $Snapshot).OSFullName doesn't work though 😞

0 Kudos
LucD
Leadership
Leadership

Try with

(Get-VMGuest -VM $Snapshot.VM).OSFullName


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos