This script will list all virtual machines with swapping memory:
$findswap = @()
foreach($vm in (Get-View -ViewType VirtualMachine | Where-Object `
{$_.Summary.QuickStats.SwappedMemory -ne “0”})){
$select = “” | Select-Object VM, `
SwappedMemory$select.VM = $vm.Name
$select.SwappedMemory = $vm.Summary.QuickStats.SwappedMemory$findswap += $select
}
$findswap