VMware Cloud Community
dflint
Enthusiast
Enthusiast
Jump to solution

Moving powered off VM to a different host with PowerCLI

I am having trouble moving my vCenter VM to a new ESXi host.
(VMotion is currently unabailable)

Old Host 192.168.1.6
New Host 192.168.1.9

Connect-VIServer 192.168.1.6
Name                           Port  User
----                           ----  ----
192.168.1.6                    443   root
Get-VM -Name vCenter | Move-VM -Destination 192.168.1.9
Move-VM : 12/29/2012 10:48:09 AM    Move-VM        Could not find VIContainer w
ith name '192.168.1.9'.

Version 5.1.0 Build 914609

Reply
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The Move-VM cmdlet uses vMotion. So if you have powered off the vCenter server, then you can not use the Move-VM cmdlet to move it.

You could unregister the vCenter server from the old host and register it again on the new host.

Something like:

Connect-VIserver oldHost

Remove-VM -VM vCenter -Confirm:$false

Disconnect-VIserver oldHost -Confirm:$false

Connect-VIserver newHost

cd vmstores:\newHost@443\Datacenter\Storage1\vCenter\
$vmxFile = Get-Item vCenter.vmx
$vmhost = Get-VMHost -Name newHost

New-VM -VMHost $vmhost -VMFilePath $vmxFile.DatastoreFullPath
Disconnect-VIserver newHost -Confirm:$false

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

Reply
0 Kudos
3 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

I moved your question from VMware ESXi 5 to VMware vSphere™ PowerCLI.

You should specify the name with wich the host is known in the vCenter server. Something like:

Get-VM -Name vCenter | Move-VM -Destination (Get-VMHost -Name NewHost,yourdomain.com)
Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
dflint
Enthusiast
Enthusiast
Jump to solution

Thanks for responding. Unfortunately I received the same message.

The VM I need to move, vCenter, is powered off.
vMotion is currently unavailable becase I have two hosts that are currently running on very different hardware.
We are replacing both hosts which will be identical but I can't shut the old host down until I migrate all the VMs off of it.

Connect-VIServer 192.168.1.6

Name                           Port  User
----                           ----  ----
192.168.1.6                    443   root


Get-VM -Name vCenter | Move-VM -Destination vHost2.internal.housingnm.org
Move-VM : 12/29/2012 12:14:10 PM    Move-VM        Could not find VIContainer with name 'vHost2.internal.housingnm.org'.

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The Move-VM cmdlet uses vMotion. So if you have powered off the vCenter server, then you can not use the Move-VM cmdlet to move it.

You could unregister the vCenter server from the old host and register it again on the new host.

Something like:

Connect-VIserver oldHost

Remove-VM -VM vCenter -Confirm:$false

Disconnect-VIserver oldHost -Confirm:$false

Connect-VIserver newHost

cd vmstores:\newHost@443\Datacenter\Storage1\vCenter\
$vmxFile = Get-Item vCenter.vmx
$vmhost = Get-VMHost -Name newHost

New-VM -VMHost $vmhost -VMFilePath $vmxFile.DatastoreFullPath
Disconnect-VIserver newHost -Confirm:$false

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos