LucD,
Below script which you helped, I am able to get the VMs which doesnt have particular Snapshot
Get-Folder POC | Get-VM |
Where-Object{$_.Guest.OSFullName -notmatch 'Microsoft'} |
Where-Object {(Get-Snapshot -VM $_).Name -notcontains "24Sep2022_Before_Patching"} |
Get-Snapshot |
Select @{N='Folder';E={$_.Vm.Folder}},
@{N='VM';E={$_.Vm.Name}},
@{N='OS';E={$_.VM.Guest.OSFullName}},
Name, Created, PowerState |
Format-Table -auto
But If I want to get VMs with which has particular snapshot created, then I am getting the other snapshot information along with the snapshot, now how can I suppress other snapshot information of a VM and get only requested snapshot info - 24Sep2022_Before_Patching?
Get-Folder POC | Get-VM |
Where-Object{$_.Guest.OSFullName -notmatch 'Microsoft'} |
Where-Object {(Get-Snapshot -VM $_).Name -contains "24Sep2022_Before_Patching"} |
Get-Snapshot |
Select @{N='Folder';E={$_.Vm.Folder}},
@{N='VM';E={$_.Vm.Name}},
@{N='OS';E={$_.VM.Guest.OSFullName}},
Name, Created, PowerState |
Format-Table -auto