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

Yellow Bricks

by Duncan Epping

  • Home
  • Unexplored Territory Podcast
  • HA Deepdive
  • 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″

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 and Distinguished Engineering Architect at Broadcom. Besides writing on Yellow-Bricks, Duncan is the co-author of the vSAN Deep Dive and the vSphere Clustering Deep Dive book series. Duncan is also the host of the Unexplored Territory Podcast.

Follow Us

  • X
  • Spotify
  • RSS Feed
  • LinkedIn

Recommended Book(s)

Advertisements




Copyright Yellow-Bricks.com © 2025 · Log in