Try like this
$vmlist=Get-Content"C:\VM\Snapshots\vmlists.txt"
foreach($VMin$VMlist) {
Get-Snapshot-VM $vm-Name 'Prior to install VM Hardware'|
Remove-Snapshot-Confirm:$false
}
Disconnect-VIServer-Confirm:$false
Try like this
foreach($VMin$VMlist) {
Get-Snapshot-VM $vm-Name 'Prior to install VM Hardware'|
Remove-Snapshot-Confirm:$false
}
Disconnect-VIServer-Confirm:$false