Esxcli

From Thomas-Krenn-Wiki
Jump to: navigation, search

VMware esxcli is suitable for many administration tasks and can be easily accessed from the command line. It is available directly on the ESXi Host and also as part of the VMware vSphere CLI 5.0.

When using esxcli on the vSphere CLI the IP, the desired ESXi host name or the vCenter server must be entered with the -s option.

Help Option

Information about the available commands (Available Namespaces) for each case are given with the help option:

user@ubuntu-11-10:~$ esxcli -s 10.1.102.154 -u root --help
Enter password: 
Usage: esxcli [options] {namespace}+ {cmd} [cmd options]

Options:
  -c CONFIG, --config=CONFIG
                        (variable VI_CONFIG)
                        Location of the configuration file
  --encoding=ENCODING   (variable VI_ENCODING, default 'utf8')
                        Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
  -s SERVER, --server=SERVER
                        (variable VI_SERVER)
                        vCenter server or ESX host to connect to. Required if url is not present
  --portnumber=PORTNUMBER
                        (variable VI_PORTNUMBER)
                        Port used to connect to server
  --protocol=PROTOCOL   (variable VI_PROTOCOL, default 'https')
                        Protocol used to connect to server (http / https)
  --servicepath=SERVICEPATH
                        (variable VI_SERVICEPATH, default '/sdk/webService')
                        Service path used to connect to server
  -r URL, --url=URL     (variable VI_URL)
                        VI SDK URL to connect to. Required if server is not present
  -h VIHOST, --vihost=VIHOST
                        (variable VI_HOST, no default)
                        ESX host when connecting through vCenter
  -u USERNAME, --username=USERNAME
                        (variable VI_USERNAME)
                        Username
  -p PASSWORD, --password=PASSWORD
                        (variable VI_PASSWORD)
                        Password
  -f SESSIONFILE, --sessionfile=SESSIONFILE
                        (variable VI_SESSIONFILE)
                        File containing session ID/cookie to utilize
  --savesessionfile=SAVESESSIONFILE
                        (variable VI_SAVESESSIONFILE)
                        File to save session ID/cookie to utilize
  --credstore=CREDSTORE
                        (variable VI_CREDSTORE), defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and
                        <APPDATA>/VMware/credstore/vicredentials.xml on Windows)
                        Credential store file path
  -a, --passthroughauth
                        (variable VI_PASSTHROUGHAUTH)
                        Attempt to use pass-through authentication
  --passthroughauthpackage=PASSTHROUGHAUTHPACKAGE
                        (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
                        Pass-through authentication negotiation package
  -t CACERTSFILE, --cacertsfile=CACERTSFILE
                        (variable VI_CACERTFILE)
                        CA certificates file
  --formatter=FORMATTER
                        Override the formatter to use for a given command. Available formatter: xml, csv, keyvalue
  --debug               Enable debug or internal use options
  --version             Display version information for the script
  -?, --help            Display usage information for the script

Available Namespaces:
  esxcli                Commands that operate on the esxcli system itself allowing users to get additional information.
  fcoe                  VMware FCOE commands.
  hardware              VMKernel hardware properties and commands for configuring hardware.
  iscsi                 VMware iSCSI commands.
  network               Operations that pertain to the maintenance of networking on an ESX host. This includes a wide variety of commands to
                        manipulate virtual networking components (vswitch, portgroup, etc) as well as local host IP, DNS and general host
                        networking settings.
  software              Manage the ESXi software image and packages
  storage               VMware storage commands.
  system                VMKernel system properties and commands for configuring properties of the kernel core system.
  vm                    A small number of operations that allow a user to Control Virtual Machine operations.

Name Spaces

The available name spaces can be displayed by using the esxcli command list option:

user@ubuntu-11-10:~$ esxcli -s 10.1.102.154 -u root esxcli command list
Enter password: 
Namespace                                           Command    
--------------------------------------------------  -----------
esxcli.command                                      list       
fcoe.adapter                                        list       
fcoe.nic                                            disable    
fcoe.nic                                            discover   
fcoe.nic                                            list       
hardware.bootdevice                                 list       
hardware.clock                                      get        
hardware.clock                                      set        
hardware.cpu.cpuid                                  get        
hardware.cpu.global                                 get        
hardware.cpu.global                                 set        
hardware.cpu                                        list       
hardware.memory                                     get        
hardware.pci                                        list       
hardware.platform                                   get        
iscsi.adapter.auth.chap                             get        
iscsi.adapter.auth.chap                             set        
iscsi.adapter.capabilities                          get        
iscsi.adapter.discovery                             rediscover 
iscsi.adapter.discovery.sendtarget                  add        
iscsi.adapter.discovery.sendtarget.auth.chap        get        
iscsi.adapter.discovery.sendtarget.auth.chap        set        
iscsi.adapter.discovery.sendtarget                  list       
iscsi.adapter.discovery.sendtarget.param            get        
iscsi.adapter.discovery.sendtarget.param            set        
iscsi.adapter.discovery.sendtarget                  remove     
iscsi.adapter.discovery.statictarget                add        
iscsi.adapter.discovery.statictarget                list       
iscsi.adapter.discovery.statictarget                remove     
iscsi.adapter.discovery.status                      get        
iscsi.adapter.firmware                              get        
iscsi.adapter.firmware                              set        
iscsi.adapter                                       get        
iscsi.adapter                                       list       
iscsi.adapter.param                                 get        
iscsi.adapter.param                                 set        
iscsi.adapter                                       set        
iscsi.adapter.target                                list       
iscsi.adapter.target.portal.auth.chap               get        
iscsi.adapter.target.portal.auth.chap               set        
iscsi.adapter.target.portal                         list       
iscsi.adapter.target.portal.param                   get        
iscsi.adapter.target.portal.param                   set        
iscsi.ibftboot                                      get        
iscsi.ibftboot                                      import     
iscsi.logicalnetworkportal                          list       
iscsi.networkportal                                 add        
iscsi.networkportal.ipconfig                        get        
iscsi.networkportal.ipconfig                        set        
iscsi.networkportal                                 list       
iscsi.networkportal                                 remove     
iscsi.physicalnetworkportal                         list       
iscsi.physicalnetworkportal.param                   get        
iscsi.physicalnetworkportal.param                   set        
iscsi.plugin                                        list       
iscsi.session                                       add        
iscsi.session.connection                            list       
iscsi.session                                       list       
iscsi.session                                       remove     
iscsi.software                                      get        
iscsi.software                                      set        
network.fence                                       list       
network.fence.network.bte                           list       
network.fence.network                               list       
network.fence.network.port                          list       
network.firewall                                    get        
network.firewall                                    load       
network.firewall                                    refresh    
network.firewall.ruleset.allowedip                  add        
network.firewall.ruleset.allowedip                  list       
network.firewall.ruleset.allowedip                  remove     
network.firewall.ruleset                            list       
network.firewall.ruleset.rule                       list       
network.firewall.ruleset                            set        
network.firewall                                    set        
network.firewall                                    unload     
network.ip.connection                               list       
network.ip.dns.search                               add        
network.ip.dns.search                               list       
network.ip.dns.search                               remove     
network.ip.dns.server                               add        
network.ip.dns.server                               list       
network.ip.dns.server                               remove     
network.ip                                          get        
network.ip.interface                                add        
network.ip.interface.ipv4                           get        
network.ip.interface.ipv4                           set        
network.ip.interface.ipv6.address                   add        
network.ip.interface.ipv6.address                   list       
network.ip.interface.ipv6.address                   remove     
network.ip.interface.ipv6                           get        
network.ip.interface.ipv6                           set        
network.ip.interface                                list       
network.ip.interface                                remove     
network.ip.interface                                set        
network.ip.neighbor                                 list       
network.ip                                          set        
network.nic                                         down       
network.nic                                         get        
network.nic                                         list       
network.nic                                         set        
network.nic                                         up         
network.vswitch.dvs.vmware                          list       
network.vswitch.standard                            add        
network.vswitch.standard                            list       
network.vswitch.standard.policy.failover            get        
network.vswitch.standard.policy.failover            set        
network.vswitch.standard.policy.security            get        
network.vswitch.standard.policy.security            set        
network.vswitch.standard.policy.shaping             get        
network.vswitch.standard.policy.shaping             set        
network.vswitch.standard.portgroup                  add        
network.vswitch.standard.portgroup                  list       
network.vswitch.standard.portgroup.policy.failover  get        
network.vswitch.standard.portgroup.policy.failover  set        
network.vswitch.standard.portgroup.policy.security  get        
network.vswitch.standard.portgroup.policy.security  set        
network.vswitch.standard.portgroup.policy.shaping   get        
network.vswitch.standard.portgroup.policy.shaping   set        
network.vswitch.standard.portgroup                  remove     
network.vswitch.standard.portgroup                  set        
network.vswitch.standard                            remove     
network.vswitch.standard                            set        
network.vswitch.standard.uplink                     add        
network.vswitch.standard.uplink                     remove     
software.acceptance                                 get        
software.acceptance                                 set        
software.profile                                    get        
software.profile                                    install    
software.profile                                    update     
software.profile                                    validate   
software.sources.profile                            get        
software.sources.profile                            list       
software.sources.vib                                get        
software.sources.vib                                list       
software.vib                                        get        
software.vib                                        install    
software.vib                                        list       
software.vib                                        remove     
software.vib                                        update     
storage.core.adapter                                list       
storage.core.adapter                                rescan     
storage.core.adapter.stats                          get        
storage.core.claiming                               autoclaim  
storage.core.claiming                               reclaim    
storage.core.claiming                               unclaim    
storage.core.claimrule                              add        
storage.core.claimrule                              convert    
storage.core.claimrule                              list       
storage.core.claimrule                              load       
storage.core.claimrule                              move       
storage.core.claimrule                              remove     
storage.core.claimrule                              run        
storage.core.device.detached                        list       
storage.core.device.detached                        remove     
storage.core.device                                 list       
storage.core.device.partition                       list       
storage.core.device                                 set        
storage.core.device                                 setconfig  
storage.core.device.stats                           get        
storage.core.device.vaai.status                     get        
storage.core.device.world                           list       
storage.core.path                                   list       
storage.core.path                                   set        
storage.core.path.stats                             get        
storage.core.plugin                                 list       
storage.core.plugin.registration                    add        
storage.core.plugin.registration                    list       
storage.core.plugin.registration                    remove     
storage.filesystem                                  automount  
storage.filesystem                                  list       
storage.filesystem                                  mount      
storage.filesystem                                  rescan     
storage.filesystem                                  unmount    
storage.nfs                                         add        
storage.nfs                                         list       
storage.nfs                                         remove     
storage.nmp.device                                  list       
storage.nmp.device                                  set        
storage.nmp.path                                    list       
storage.nmp.psp.fixed.deviceconfig                  get        
storage.nmp.psp.fixed.deviceconfig                  set        
storage.nmp.psp.generic.deviceconfig                get        
storage.nmp.psp.generic.deviceconfig                set        
storage.nmp.psp.generic.pathconfig                  get        
storage.nmp.psp.generic.pathconfig                  set        
storage.nmp.psp                                     list       
storage.nmp.psp.roundrobin.deviceconfig             get        
storage.nmp.psp.roundrobin.deviceconfig             set        
storage.nmp.satp.generic.deviceconfig               get        
storage.nmp.satp.generic.deviceconfig               set        
storage.nmp.satp.generic.pathconfig                 get        
storage.nmp.satp.generic.pathconfig                 set        
storage.nmp.satp                                    list       
storage.nmp.satp.rule                               add        
storage.nmp.satp.rule                               list       
storage.nmp.satp.rule                               remove     
storage.nmp.satp                                    set        
storage.vmfs.extent                                 list       
storage.vmfs.snapshot.extent                        list       
storage.vmfs.snapshot                               list       
storage.vmfs.snapshot                               mount      
storage.vmfs.snapshot                               resignature
storage.vmfs                                        upgrade    
system.boot.device                                  get        
system.coredump.network                             get        
system.coredump.network                             set        
system.coredump.partition                           get        
system.coredump.partition                           list       
system.coredump.partition                           set        
system.hostname                                     get        
system.hostname                                     set        
system.module                                       get        
system.module                                       list       
system.module                                       load       
system.module.parameters                            list       
system.module.parameters                            set        
system.module                                       set        
system.process                                      list       
system.process.stats.load                           get        
system.process.stats.running                        get        
system.secpolicy.domain                             list       
system.secpolicy.domain                             set        
system.settings.advanced                            list       
system.settings.advanced                            set        
system.settings.kernel                              list       
system.settings.kernel                              set        
system.settings.keyboard.layout                     get        
system.settings.keyboard.layout                     list       
system.settings.keyboard.layout                     set        
system.stats.uptime                                 get        
system.syslog.config                                get        
system.syslog.config.logger                         list       
system.syslog.config.logger                         set        
system.syslog.config                                set        
system.syslog                                       mark       
system.syslog                                       reload     
system.time                                         get        
system.time                                         set        
system.uuid                                         get        
system.version                                      get        
system.visorfs                                      get        
system.visorfs.ramdisk                              add        
system.visorfs.ramdisk                              list       
system.visorfs.ramdisk                              remove     
system.visorfs.tardisk                              list       
system.welcomemsg                                   get        
system.welcomemsg                                   set        
vm.process                                          kill       
vm.process                                          list       


Foto Werner Fischer.jpg

Author: Werner Fischer

Werner Fischer, working in the Web Operations & Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.


Related articles

Esxcli - Installing VIB on an ESXi 5.0 host
Starting Virtual Machines automatically under VMware ESXi
VMware ESXi 5.0 Installation