cannot use script to vmotion vms

I trid to use the following script to migrate vms. but it complains about the object names. Could anyone help to take a look>?


PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> gc .\vms.txt| Where-Object { $_.Trim() } | %{Get-VM -Name $_ | Move-VM -Destination ca-vmhost03.lacare.org -
runasync}
Move-VM : 6/25/2015 8:55:15 PM    Move-VM        Could not find VIContainer with name 'ca-vmhost03.lacare.org'.
At line:1 char:64
+ gc .\vms.txt| Where-Object { $_.Trim() } | %{Get-VM -Name $_ | Move-VM -Destinat ...
+                                                                ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (ca-vmhost03.lacare.org:String) [Move-VM], VimException
    + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

Move-VM : 6/25/2015 8:55:15 PM    Move-VM        VIContainer parameter: Could not find any of the objects specified by name.
At line:1 char:64
+ gc .\vms.txt| Where-Object { $_.Trim() } | %{Get-VM -Name $_ | Move-VM -Destinat ...
+                                                                ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (VMware.VimAutom...ner Destination:RuntimePropertyInfo) [Move-VM], ObnRecordProcessingFailedException
    + FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ObjectNotFoundCritical,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>
Jason YuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zephyr ICTCloud ArchitectCommented:
Does it work if you replace your VMHost name with its IP-address? Like so:

gc .\vms.txt| Where-Object { $_.Trim() } | %{Get-VM -Name $_ | Move-VM -Destination (Get-VMHost 11.22.33.44)

Open in new window


Replace 11.22.33.44 with the IP-address of your VMHost.

If that works there could be issues with the host DNS name not resolving correctly.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
compdigit44Commented:
How did you format the vm.txt file? Each host on a separate line separated by semicolons...

I would assume a manually vmotion works just fine correct?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VMware

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.