The command "Get-VMhost -name ESXhost | Get-VM" return more VMs than that there on the VMware ESX host currently. Anybody seen this before?
its probably returning all the VM on the host ( ESXHost) both powered on and powered off...
Maybe it's the dreaded "VM creep"
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org
is it showing your templates as well?
No its one VMware ESX server of a cluster of 8 servers. I did a VMotion of all VMs except one on the VMware ESX server . Only one VM active and no powered off VMs or templates.
what script are you using?
are you specifying the esx-hostname?? if not, it might pull all of the vm's of the cluster/dc
Yes i'am specifying the ESX hostname
Get-VMhost -name ESXhostname | Get-VM"
looks like from my testing its getting the entire cluster...
try connecting directly to the host instead of vc and see if you see the same results
connecting directly to the host works, but i want to make a script that all VMs on the specified ESX hosts get vmotioned with the move-vm command.
See if this works:
( Get-VMHost foo | Get-View ).VM | foreach-object { $_ | Get-VIObjectByVIView }
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org
figured it out, seems like a bug...
try: Get-VM | Where-Object {$_.Host.Name -eq "esxhost"}
$hostinfo = get-vmhost "vmhostname"
$vmviews = (Get-View $hostinfo.ID).VM
$vmviews | % {
$_ | Get-VIOBjectByVIView
}
Hi,
Could you please give some more details about the environment against which you are reproducing this issue. I've tried to reproduce it against a vc that has a couple of hosts inside a single cluster each containing several vms. When I execute Get-Vmhost -Name MyESX | Get-Vm everything seems to be OK and the result contains only the vms from MyESX.
Which version of the toolkit (Get-VIToolkitVersion) are you using?
10x in advance for the info!
\Yavor