VMware Cloud Community
reebobonk
Enthusiast
Enthusiast
Jump to solution

Moving Vms from one vSphere center to another one. Error: Move-VM Could not find Machine with name

When I submit: Move-VM -VM $VMname.Name -Destination $destination.name -Datastore $destinationDatastore

The error occurs: Error: Move-VM Could not find Machine with name 'xxxx'

Get-VM -Name $VMName gets the name correctly. So,what could be the problem and how to solve it?

 

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
reebobonk
Enthusiast
Enthusiast
Jump to solution

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Why do you use $VMname.Name?
What exactly do you have in $VMName?

Does any of the following work?

Move-VM -VM $VMname -Destination $destination.name -Datastore $destinationDatastore

Move-VM -VM (Get-VM -Name $VMname.Name) -Destination $destination.name -Datastore $destinationDatastore




Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
reebobonk
Enthusiast
Enthusiast
Jump to solution

$destination.name = FQDN of the host

Move-VM -VM $VMname -Destination $destination.name -Datastore $destinationDatastore
Move-VM : 19-8-2022 12:38:42 Move-VM Could not find VIContainer with name 'DESTINATIONHOST'

Get-VMHost -Name DESTINATIONHOST-FQDN gives correct result

Reply
0 Kudos
reebobonk
Enthusiast
Enthusiast
Jump to solution

BTW:

PowerCLI Version
----------------
VMware PowerCLI 10.1.0 build 8346946
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 8344055

PowerCLI Version
----------------
VMware PowerCLI 10.1.0 build 8346946
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 8344055

PowerCLI Version
----------------
VMware PowerCLI 10.1.0 build 8346946
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 83440

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

My question was about $VMName.Name

Perhaps it could be useful if you also showed how you populate all these variables that you use.
Also, instead of $destination.Name why don't you use just $destination?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
reebobonk
Enthusiast
Enthusiast
Jump to solution

Even if I don't use variables but use the hardcoded names it fails.

Move-VM -VM VMname  -Destination FQDN-dest 

Move-VM : 19-8-2022 15:19:30 Move-VM Could not find VirtualMachine with name 'VMname '.

Or this: Get-VM -Name VMname  | Move-VM -Destination FQDN-dest

Move-VM : 19-8-2022 15:21:25 Move-VM Could not find VIContainer with name 'FQDN-dest'.

If I move the machine to another host in the same cluster it works.

Reply
0 Kudos
reebobonk
Enthusiast
Enthusiast
Jump to solution

If found GitHub - skant11/PSxVCvMotion and this works for me.

Reply
0 Kudos