Dear Experts,
Our requirement is as follows,
We would like to have a weekly report of the snapshot usage within the vCenter. Here, we would like to filter out some of the VMs based on the folders that they exist.
I have come across many snapshot reports but none of them cater to our needs to filter them by the folders.
For example, we would like to exclude VMs which are in the folders "TEST" "REPLICAS" etc.
Thanks in advance!
Regards,
Karthik
Hi.
You could try something like this.
Get-Vm | where {$_.Folder -ne "TEST" -and $_.Folder -ne "REPLICAS"} | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
or
$Folders = "TEST", "REPLICAS"
Get-Vm | where {$Folders -NotContains $_.Folder.name } | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
Taking into account that casting is determined by the left operand, that should be
Get-Vm | where {$_.Folder.Name -ne "TEST" -and $_.Folder.Name -ne "REPLICAS"} | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
or
Get-Vm | where {"TEST" -ne $_.Folder -and "REPLICAS" -ne $_.Folder} | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi.
You could try something like this.
Get-Vm | where {$_.Folder -ne "TEST" -and $_.Folder -ne "REPLICAS"} | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
or
$Folders = "TEST", "REPLICAS"
Get-Vm | where {$Folders -NotContains $_.Folder.name } | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
Taking into account that casting is determined by the left operand, that should be
Get-Vm | where {$_.Folder.Name -ne "TEST" -and $_.Folder.Name -ne "REPLICAS"} | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
or
Get-Vm | where {"TEST" -ne $_.Folder -and "REPLICAS" -ne $_.Folder} | Get-Snapshot | Select-Object Description, Created, VM, SizeMB, SizeGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
