Vimsh: Difference between revisions

From VI-Toolkit
Jump to navigation Jump to search
No edit summary
(Added William's article about vimsh)
 
(14 intermediate revisions by 3 users not shown)
Line 3: Line 3:
The Virtual Infrastructure metashell is an undocumented and unsupported shell accessible from within the console on an ESX server.
The Virtual Infrastructure metashell is an undocumented and unsupported shell accessible from within the console on an ESX server.
It can be invoked from the shell when logged in as root user as an interactive shell.
It can be invoked from the shell when logged in as root user as an interactive shell.
You can almost do anything from it what you can do from the Virtual Infrastructure client and is more powerful as the normal console commands.
You can do almost anything from it what you can do from the Virtual Infrastructure client and is more powerful as the normal [[RCLI]] console commands.


Below is some output of the shell that you get to see and the output of the "?" command:
Below is some output of the shell that you get to see and the output of the "?" command:


#vimsh
  [/]$ ?
  [/]$ ?
  hostsvc/      vmsvc/        csinfo        help           puload      
  hostsvc/      vmsvc/        csinfo        help         puload
  internalsvc/  ?               csls           pinfo         puse        
  internalsvc/  ?             csls         pinfo         puse
  proxysvc/   argtype      csuimport pload        quit        
  proxysvc/     argtype      csuimport     pload        quit
  solo/          cls              echo         ploadpath   sleep        
  solo/         cls           echo         ploadpath     sleep
  vimsvc/      csimport      exit          pls            source
  vimsvc/      csimport      exit         pls           source




There's a separation between plugins and direct commands. The items from the list above that end in a "/" are plugins. (is this true or are they just idicating that there's a submenu?)
 
There's a separation between plugins and direct commands. The items from the list above that end in a "/" are plugins. (is this true or are they just idicating that there's a submenu?) You can use tab-completion in order to find the available parameters for any of the commands.


An advantage of vimsh over normal esx-cfg commands is that the changes are immediate, so you do not need to restart the vmware management services.
An advantage of vimsh over normal esx-cfg commands is that the changes are immediate, so you do not need to restart the vmware management services.


In recent versions of ESX, there's also a command line non interactive version of vimsh that can be used from within a script which is called [[vmware-vim-cmd]]
In recent versions of ESX (ESX3.5+), there's also a non interactive command line version of vimsh that can be used from within a script which is called [[vmware-vim-cmd]] and is much easier to read in your scripts as the alternative: vimsh -n -e "command"
 
'''ESX 3.0.x+'''
  /usr/bin/vimsh -n -e "command"
 
'''ESX 3.5+'''
/usr/bin/vimsh -n -e "command"
/usr/bin/vmware-vim-cmd "command"
 
'''ESXi 3.5+'''
/bin/vim-cmd "command"
 
/usr/bin/vimsh is a symbolic link to the file [[vmware-vimsh]] in the same folder.


==== List of commands ====
==== List of commands ====


Following is a list of the availabled commands (the vimsh: prefix is only included as a namespace, so that it won't clash with other parts in the wiki, not sure if that's a smart thing to do...)
Following is a list of the available commands (the vimsh: prefix is only included as a namespace, so that it won't clash with other parts in the wiki)
 
Over time I will try to add the info found about this in here (help would be EXTREMELY appreciated) right now it just lists what is available in the online help and in many cases some example output of the commands.


  [[vimsh: hostsvc/]]
  [[vimsh: hostsvc/]]
[[vimsh: internalsvc/]]
[[vimsh: proxysvc/]]
[[vimsh: solo/]]
[[vimsh: vimsvc/]]
  [[vimsh: vmsvc/]]         
  [[vimsh: vmsvc/]]         
[[vimsh: ?]]
[[vimsh: argtype]]
[[vimsh: cls]]
[[vimsh: csimport]]
  [[vimsh: csinfo]]
  [[vimsh: csinfo]]
[[vimsh: csls]]
[[vimsh: csuimport]]
[[vimsh: echo]]
[[vimsh: exit]]
  [[vimsh: help]]
  [[vimsh: help]]
  [[vimsh: puload]]
  [[vimsh: puload]]
[[vimsh: internalsvc/]]
[[vimsh: csls]]
  [[vimsh: pinfo]]
  [[vimsh: pinfo]]
[[vimsh: pload]]
[[vimsh: ploadpath]]
[[vimsh: pls]]
  [[vimsh: puse]]           
  [[vimsh: puse]]           
[[vimsh: proxysvc/]]
[[vimsh: argtype]]
[[vimsh: csuimport]]
[[vimsh: pload]]
  [[vimsh: quit]]           
  [[vimsh: quit]]           
[[vimsh: solo/]]
[[vimsh: cls]]
[[vimsh: echo]]
[[vimsh: ploadpath]]
  [[vimsh: sleep]]         
  [[vimsh: sleep]]         
[[vimsh: vimsvc/]]
[[vimsh: csimport]]
[[vimsh: exit]]
[[vimsh: pls]]
  [[vimsh: source]]
  [[vimsh: source]]


Line 54: Line 69:


This command has its origin as a support shell only.  
This command has its origin as a support shell only.  
It is rumored about that it will be supported in one of the upcoming versions of ESX  
It is rumored about that vimsh will be supported in one of the upcoming versions of ESX  


==== External links ====
==== External links ====


[http://knowledge.xtravirt.com/white-papers/scripting.html Xtravirt scripting papers about vimsh among others]
As there's no official documentation, here's the link to the current authorative documentation:
* [http://knowledge.xtravirt.com/white-papers/scripting.html Xtravirt scripting papers about vimsh among others]
 
Example usage (article in dutch)
* [http://www.l4l.be/docs/virt/vimsh.php Voorbeelden gebruik VIMSH]
 
Other articles with examples:
* [http://www.rtfm-ed.co.uk/?p=372 Updated: Enabling VMotion from the CLI/Kickstart Script]
 
* [http://effectief.blogspot.com/2007/09/vimsh-handy-vmware-esx-command-line.html Koen Warsons blog: handy Vmware ESX Command line tool]
 
* [http://vmwaretips.com/wp/2008/09/12/netapp-snapshots-in-esx/#more-20 NetApp Snapshots in ESX]
 
* [http://malaysiavm.com/blog/how-to-update-vmware-esx-patch-using-cli/ How-to update vmware ESX using CLI]
 
* [http://engineering.ucsb.edu/~duonglt/vmware/#vmware_vimsh William Lam's "VMware's undocumented vimsh"]
 
[[Category: ESX]][[Category: SDK]][[Category: Vimsh]]

Latest revision as of 14:06, 30 June 2009

The VI metashell

The Virtual Infrastructure metashell is an undocumented and unsupported shell accessible from within the console on an ESX server. It can be invoked from the shell when logged in as root user as an interactive shell. You can do almost anything from it what you can do from the Virtual Infrastructure client and is more powerful as the normal RCLI console commands.

Below is some output of the shell that you get to see and the output of the "?" command:

[/]$ ?
hostsvc/      vmsvc/        csinfo        help          puload
internalsvc/  ?             csls          pinfo         puse
proxysvc/     argtype       csuimport     pload         quit
solo/         cls           echo          ploadpath     sleep
vimsvc/       csimport      exit          pls           source


There's a separation between plugins and direct commands. The items from the list above that end in a "/" are plugins. (is this true or are they just idicating that there's a submenu?) You can use tab-completion in order to find the available parameters for any of the commands.

An advantage of vimsh over normal esx-cfg commands is that the changes are immediate, so you do not need to restart the vmware management services.

In recent versions of ESX (ESX3.5+), there's also a non interactive command line version of vimsh that can be used from within a script which is called vmware-vim-cmd and is much easier to read in your scripts as the alternative: vimsh -n -e "command"

ESX 3.0.x+

 /usr/bin/vimsh -n -e "command"

ESX 3.5+

/usr/bin/vimsh -n -e "command"
/usr/bin/vmware-vim-cmd "command"

ESXi 3.5+

/bin/vim-cmd "command"

/usr/bin/vimsh is a symbolic link to the file vmware-vimsh in the same folder.

List of commands

Following is a list of the available commands (the vimsh: prefix is only included as a namespace, so that it won't clash with other parts in the wiki)

Over time I will try to add the info found about this in here (help would be EXTREMELY appreciated) right now it just lists what is available in the online help and in many cases some example output of the commands.

vimsh: hostsvc/
vimsh: internalsvc/
vimsh: proxysvc/
vimsh: solo/
vimsh: vimsvc/
vimsh: vmsvc/        
vimsh: ?
vimsh: argtype
vimsh: cls
vimsh: csimport
vimsh: csinfo
vimsh: csls
vimsh: csuimport
vimsh: echo
vimsh: exit
vimsh: help
vimsh: puload
vimsh: pinfo
vimsh: pload
vimsh: ploadpath
vimsh: pls
vimsh: puse          
vimsh: quit          
vimsh: sleep         
vimsh: source

Background info

This command has its origin as a support shell only. It is rumored about that vimsh will be supported in one of the upcoming versions of ESX

External links

As there's no official documentation, here's the link to the current authorative documentation:

Example usage (article in dutch)

Other articles with examples: