Here’s the cousin script to the add NFS datastore to multiple esx hosts.
$ds_name = (Read-Host "Enter datastore name to delete") $vm_hosts = Get-VMHost -Datastore $ds_name foreach($esx in $vm_hosts) { Remove-Datastore -VMHost $esx.Name -Datastore $ds_name -ErrorAction SilentlyContinue -Confirm:$false -RunAsync | Out-Null Write-Host $ds_name removed from $esx.Name }