I see. It looks as if you have these VMs with the same name in different datacenters.
You can also use a Get-Datacenter -Name <dcname> on the Location parameter of the Get-VM.
That way only that specific VM gets removed (and unregistered).
Something like this
$vmlist= ("vm1","vm-2","vm-3")$dcName="MyDC"
foreach ($vmnamein$vmlist) { $vm=GET-VM-Name$vmname-Location (Get-Datacenter-Name$dcName) if($vm.PowerState-ne"PoweredOff") { Stop-VM-VM$vm
Write-output"$vmname shutting down" (get-date) } Remove-VM$vm-DeleteFromDisk:$true
}