introduction
previous article we have got an overview about ESXcli command
this article we will discuss some basic ESXcli command
System ESXcli commands
esxcli system version get
Returns the ESXi build and version numbers.
esxcli system hostname get
Returns the hostname, domain and FQDN for the host
esxcli system stats installtime get
Returns the date and time of when ESXi was installed.
esxcli system account list
Lists the local users created on the ESXi host.
esxcli system account add -d=pioneers_admin -i=admin -p=P@ssw0rd -c=P@ssw0rd
This command allows you to create local ESXi users. All the parameters used in the example are mandatory.
esxcli system maintenanceMode set –e rue
Use this command to put ESXi in maintenance mode or take it out.
esxcli system shutdown reboot -d 10 -r “Patch Updates”
Use this command to reboot or shutdown ESXi. The -d parameter is a countdown timer; minimum 10 seconds. ESXi must be in maintenance mode before you can use the command
network ESXcli commands
esxcli network ip interface ipv4 get
Displays the IPv4 configuration for all the interfaces present on ESXi
firewall ESXcli commands
esxcli network firewall get
Returns the status of the ESXi firewall
esxcli network firewall set -–enabled true | false
Use this command to disable the ESXi firewall for troubleshooting purposes. Note that disabling the firewall on ESXi is highly discouraged.
software ESXcli commands
esxcli software vib list
Lists all the currently installed VIBs on ESXi. A VIB is a file packaging format used to distribute software on ESXi.
esxcli software vib update -d “/tmp/update.zip”
Use this command to update an installed VIB on ESXi. Note that the command does not install any new software. Instead it only updates what’s currently installed. Use esxcli software vib install instead when installing new software. The -d parameter specifies the full path to the package being used for the update. As per the next screenshot, I specified a non-existing patch hence the error message
VM ESXcli commands
esxcli vm process list
Lists all the running VMs on the hosts. The World ID can be used with other commands to carry out various tasks related to VMs.
esxcli vm process kill -w 2148928-t soft
Use this command to kill a running VM such as one that fails to respond to commands.
You must first retrieve the VM’s World ID (see command above ) and pass it on using the -w parameter.
storage ESXcli commands
esxcli storage vmfs extent list
The command generates a list of extents for each volume as well as the corresponding device name to UUID mapping
esxcli storage filesystem list
The command lists of all the volumes or datastores accessible by the ESXi host. The output includes the file system type, disk info along with the volume name, path and UUID.
You must first retrieve the VM’s World ID (see command above ) and pass it on using the -w parameter.
ISCSI ESXcli commands
esxcli iscsi software get
this command verifies that the iSCSI adapter is enabled.
esxcli iscsi software set –enabled true
The command enables the iSCSI software adapter
esxcli iscsi adapter param get -A vmhba65
The command returns metrics for the iSCSI adapter.
which is vmhba65 for ESXI 6.7
conclusion
esxcli is a CLI (command line interface) framework in vSphere that provides a modular architecture for various components called namespaces running in the VMkernel.
in network pioneers we believe that more practicing on CLI [Command Line Interface ] will give administrator more power to fully control vSphere Environment