VMware Cloud Community
Vimal348
Enthusiast
Enthusiast
Jump to solution

VM Snapshot

Hello,

I have some commands to check the VMs that has the snapshot name: 

$VMlist = get-vm
Get-Snapshot -VM $VMlist | where{$_.Description -eq 'Prior to install VMTools'}

But the output is displaying like this. Is there anyway I can see the VM names in the result?

Vimal348_0-1607631766164.png

 

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could use nested Where-clauses.

Get-VM |
Where-Object{Get-SNapshot -VM $_ | Where-Object{$_.Description -eq 'Prior to install VMTools'}} |
Select-Object -Property Name


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

View solution in original post

4 Replies
LucD
Leadership
Leadership
Jump to solution

You could use nested Where-clauses.

Get-VM |
Where-Object{Get-SNapshot -VM $_ | Where-Object{$_.Description -eq 'Prior to install VMTools'}} |
Select-Object -Property Name


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

Vimal348
Enthusiast
Enthusiast
Jump to solution

@LucD ,

Thank you.

Is there anyway I can list the Snapshot Date as well in the output ?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The returned Snapshot object contains a property Created, which you can add on the Select-Object cmdlet.


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

0 Kudos
Vimal348
Enthusiast
Enthusiast
Jump to solution

Thank you

0 Kudos