Command line tips and tricks #3

Posted by Duncan Epping in July 10th, 2008
Published in Server

Enter maintenance mode from the ESX command line:

vimsh -n -e /hostsvc/maintenance_mode_enter

Backup every running vm via vcb in just one command:

for /f “tokens=2 delims=:” %%i in (’vcbvmname -h <virtualcenterserver> -u <user> -p <password> -s Powerstate:on ^| find “name:”‘) do cscript pre-command.wsf “c:\program files\vmware\vmware consolidated backup framework\” %%i fullvm

Enable VMotion from the command line:

vimsh -n -e “hostsvc/vmotion/vnic_set vmk0″


7 user comments or pingbacks in this post

Follow-up this post comment rss or leave a trackback
1. William said,

You might as well mention:

vimsh -n -e /hostsvc/maintenance_mode_exit

Caveat to the Enter Maint. Mode, it does not automatically VMotion your VMs as you would through manual Maint. Mode.

2. Cathy said,

Is there a way to vmotion via command line after you put into maintenance mode?

3. Albert Widjaja said,

Hi There,

thanks for sharing you knowledge, from your script above:
for /f “tokens=2 delims=:” %%i in (’vcbvmname -h -u -p -s Powerstate:on ^| find “name:”‘) do cscript pre-command.wsf “c:\program files\vmware\vmware consolidated backup framework\” %%i fullvm

I understand that when i execute that one liner in the SSH on my ESXi server will grab all of the VMs into my vCenter Server (assuming the HDD is enough).

1. Would that script be able to transfer all of the VM in my SAN as well ?

2. how to restore the whole VM back again to the ESXi ? do I have to use vCenter Converter Standalone and restore it manually one by one ?

looking forward for the reply

Thanks,

4. Duncan said,

No I think you misunderstood the article. This is not a script that can run on an ESXi server. It’s for VMware Consolidated Backup and it needs to run on the VCB Proxy server. If you are looking for a cheap way to backup all your vm’s take a look at this script:
http://communities.vmware.com/docs/DOC-8760

Duncan

Leave A Reply Below

Currently browsing Command line tips and tricks #3

 Username (*required)

 Email Address (*private)

 Website (*optional)

Pingback and trackback

Link trail from various blogs:
Pingback on July 11th, 2008 at 00:53
Pingback on June 14th, 2009 at 22:26
Pingback on June 17th, 2009 at 20:41

Topics Search

Yellow-Bricks recommends:







VMware Fusion and VMware Workstation: Support Yellow-Bricks and get a 10% discount on select VMware products.

Train Signal:
Learn Virtualization technology with Train Signal. Support us and learn how to fully utilize VMware products at the same time! Click here for more info!

Advertisements

Recent Comments

Tags

Info