• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

Command line tips and tricks #3

Duncan Epping · Jul 10, 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″

Share it:

  • Tweet

Related

Server 3.0.x, 3.5, ESX, service console, VMware

Reader Interactions

Comments

  1. William says

    10 July, 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.

  2. Cathy says

    3 October, 2008 at 18:24

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

  3. Albert Widjaja says

    19 June, 2009 at 03:15

    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 says

    19 June, 2009 at 09:07

    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

Primary Sidebar

About the author

Duncan Epping is a Chief Technologist in the Office of CTO of the Cloud Platform BU at VMware. He is a VCDX (# 007), the author of the "vSAN Deep Dive", the “vSphere Clustering Technical Deep Dive” series, and the host of the "Unexplored Territory" podcast.

Upcoming Events

Feb 9th – Irish VMUG
Feb 23rd – Swiss VMUG
March 7th – Dutch VMUG
May 24th – VMUG Poland
June 1st – VMUG Belgium

Recommended Reads

Sponsors

Want to support Yellow-Bricks? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2023 · Log in