will this work?
have not had a chance to test
$vms = get-vm -name (get-content vms.txt)
foreach ($vm in $vms) {
get-VM -name $vm | Shutdown-VMGuest -Confirm:$false
if ($VM.PowerState -eq "PoweredOn") {
Write-Host "Shutting Down" $VMName
Shutdown-VMGuest -VM $VM
#Wait for Shutdown to complete
do {
#Wait 5 seconds
Start-Sleep -s 5
$status = $VM.PowerState
}until($status -eq "PoweredOff")
}
$vm | Set-VM –MemoryGB 8 –NumCpu 2 –Confirm:$False
$vm | Start-VM
}