$vms = Import-Csv D:\RemoveVMlist.csv
$report = @()
foreach ($vm in $vms){
if((get-vm $vm.hostname).PowerState -eq "PoweredOff")
{
$row = get-vm $vm.hostname
Remove-VM $vm.hostname -DeletePermanently -RunAsync -Confirm:$false
Write-Host "Remove done $vm"
$report += $row
###Remove-VM $vm.name -DeletePermanently -RunAsync -Confirm:$false
}
$report |Export-Csv -Path D:"$((Get-Date).ToString("yyyyMMdd"))_RemoveVMlist.csv"
}