Command line tips and tricks #3
July 10th, 2008
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″




July 10th, 2008 at 22:55
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.
July 11th, 2008 at 00:53
[...] For anyone who doesn’t subscribe to Duncan Epping’s great blog, he reminded me of this great command line snippet: [...]