VMware Cloud Community
Sbeard333
Contributor
Contributor
Jump to solution

ESX 3.5 Command Line VMotion

Hi

I run an ESX farm of four ESX servers and am looking for a way to migrate all VM's off a host prior to performing patching

Could someone please let me know if it is possible to do this from the command line via a script as migrating each VM one at a time is very time consuming

Thanks for any help in Advance

Ste

0 Kudos
1 Solution

Accepted Solutions
sbeaver
Leadership
Leadership
Jump to solution

Yes that is correct. You need fully automated for the DRS automation to work. For what ever it is worth mine is set pretty aggressive to apply with 2 or more stars

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**

View solution in original post

0 Kudos
11 Replies
shamim-a
Enthusiast
Enthusiast
Jump to solution

VMotion is a feature of VC. You can not do it through command line.

How may hosts do u have?

don't have VC in place?

Shamim

0 Kudos
TomHowarth
Leadership
Leadership
Jump to solution

you may be able to script something via the VC SDK, labourious but repeatable once done. but AFAIK there is no command line interface for VMotion, only Storage VMotion via the RCLI

Tom Howarth

VMware Communities User Moderator

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
sbeaver
Leadership
Leadership
Jump to solution

Do you have DRS setup to automatic? If you do then all you need to do is issue a command to put the host in maintenance mode and DRS wll do the rest.

Steve Beaver

VMware Communities User Moderator

====

Co-Author of "VMware ESX Essentials in the Virtual Data Center"

Coming soon to a store near you!

*Virtualization is a journey, not a project.*

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
RussH
Enthusiast
Enthusiast
Jump to solution

Seems faily simple to script in powershell (with VI Toolkit).....

Q: How do I VMotion a VM?

A: This script can be used to VMotion from ESSX1 to ESX2.

Get-VIServer -Server <Server> -User <user> -Password <password> get-vmhost ESX1 | get-vm namevm | move-vm –destination (get-vmhost ESX2)

0 Kudos
admin
Immortal
Immortal
Jump to solution

Russ is correct and if you want to move them all just leave off the vm name. Powershell is cool download the toolkit from here:

0 Kudos
TomHowarth
Leadership
Leadership
Jump to solution

I must admit I have played with the powershell toolkit, but missed that command-applet, well pointed out

Tom Howarth

VMware Communities User Moderator

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
Sbeard333
Contributor
Contributor
Jump to solution

Wow that was quick!!! Many thanks for all your replies.

I will look into the powershell options for sure.

Steve my current DRS settings are Partially Automated, i am right in thinking that if i set this to Fully Autmated when iput the host in maintenance mode all vm's will then be migrated?

Thanks again guys for your valuable help

0 Kudos
sbeaver
Leadership
Leadership
Jump to solution

Yes that is correct. You need fully automated for the DRS automation to work. For what ever it is worth mine is set pretty aggressive to apply with 2 or more stars

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
Sbeard333
Contributor
Contributor
Jump to solution

Works a treat, i wondered why my VM's were not evacuated when the host was placed in mainenance mode and now i know

Thanks again for your help.

Everydays a school day Smiley Happy

0 Kudos
hiyangyong
Contributor
Contributor
Jump to solution

actually, when you using hostops.pl, it does not allow you enter into maintenance or reboot/disconnect when there is any vm power on.

So any idea is there a way to run vmotion remotely using CLI? It seems to be only Vmtion is enabled where there is accident (ie, host crash).

Is that so? I am using hostpops.pl, but can't find any userful info for vmotion.

0 Kudos
g0rbi
Enthusiast
Enthusiast
Jump to solution

The same here. hostops.pl seems to be fine, but how to evacuate all vms bevore?

The hostevacuate.pl is not what i need, because you've to give storage information. i just want host-vmotion, no storage vmotion.

As above said - I want to enter maintenance mode and bevore move all running vm's from that host.

0 Kudos