Thanks, this is now producing the cluster name so the information is fully there.
Original Message:
Sent: Mar 12, 2025 12:01 AM
From: James Dougherty
Subject: Snapshot report that includes cluster where VM snapshot is located
Modifying yours just a little will work.
Get-VM | Get-Snapshot | select VM, Name, Description, Created, SizeMB, SizeGB, @{Name="Cluster"; Expression={ $_.VM.VMHost.Parent }}
Or using a pipeline variable will work.
Get-Cluster -PipelineVariable cluster |
Get-VM | Get-Snapshot | select @{N='VM';E={$_.VM.Name}}, Name, Description, Created, SizeMB,SizeGB,@{N='Cluster';E={$cluster.Name}}
Original Message:
Sent: Mar 11, 2025 04:22 PM
From: Christopher Digan
Subject: Snapshot report that includes cluster where VM snapshot is located
Hi All,
I'm trying to get a scheduled daily report to list any snapshots that are out there, but one of the things I'm trying to include is the cluster/host where the VM is located that has the snapshot.
Using the following command line, it gives me what I want except the cluster name.
$snapshot = Get-VM | Get-Snapshot | select VM, Name, Description, Created, SizeMB, SizeGB, @{Name="Cluster"; Expression={ $_.VM.ExtensionData.Parent.Name }} | Sort-Object -Property Name
output shows something like the following:
VM : VM Test
Name : VM Test Snapshot 03/11/2025 1:30:24 PM
Description :
Created : 3/11/2025 1:30:24 PM
SizeMB : 4.89234789234734
SizeGB : 0.0047776834886204
Cluster :
There's no description, so that being blank is expected, but the cluster is coming up with no information even though the system is in a test cluster. I know that cluster isn't a normal properly for get-snapshot, but thought it might pull through from using the get-vm where the property does exist.
Anyone have any idea how to be able to get the cluster to also show with the other snapshot information above?