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″





vSphere 4.0 Quick Start Guide
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.
[...] For anyone who doesn’t subscribe to Duncan Epping’s great blog, he reminded me of this great command line snippet: [...]
Is there a way to vmotion via command line after you put into maintenance mode?
[...] For anyone who doesn’t subscribe to Duncan Epping’s great blog, he reminded me of this great command line snippet: [...]
[...] For anyone who doesn’t subscribe to Duncan Epping’s great blog, he reminded me of this great command line snippet: [...]
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,
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