I am running command "Remove-VM -VM (Get-VM) -DeleteFromDisk".
This command is deleting vm files but vm is seen as orphaned in vcenter server.
How to completely remove vm from vcenter server as well as from the disk.
If you delete VM while connected to an ESXi server, there will be orphaned VMs in vCenter.
Why do you need to remove them on the ESXi server ?
With
Get-VM -Name MyVM | where {$_.Host.Name -eq "MyEsx"} | Remove-VM -DeletePermanently -Confir:$false
you can remove the VM completely, and the vCenter registration will be removed as well.
Your problem to connect to the ESXi with its IP address could have several reasons: port 902 is not open, the host is not reachable....
Are there any error messages ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could it be that you are connected to an ESXi server and not to the vCenter (with the Connect-VIServer cmdlet) ?
The VM registration is done on the vCenter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for reply.
It works well if i pass "vcenter server ip" for -Server argument but doesnot work for if i pass "esx ip".
I want to delete vms of particular esx host.
Pls help me out
If you delete VM while connected to an ESXi server, there will be orphaned VMs in vCenter.
Why do you need to remove them on the ESXi server ?
With
Get-VM -Name MyVM | where {$_.Host.Name -eq "MyEsx"} | Remove-VM -DeletePermanently -Confir:$false
you can remove the VM completely, and the vCenter registration will be removed as well.
Your problem to connect to the ESXi with its IP address could have several reasons: port 902 is not open, the host is not reachable....
Are there any error messages ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks!!! It works...