0% found this document useful (0 votes)
150 views18 pages

Vmware Vcap-Dca Cli Cheat Sheet v1.0

This cheat sheet provides concise summaries of Unix commands and VMware vSphere command line tools for the VCAP-DCA certification exam in 3 sentences or less: It lists common Unix commands like man, ls, cd, find, vi, cat, grep, more, tail, less, df, and ps. It also covers ESXi command line tools like esxcfg, vifs, vmkfstools, vicfg-hostops, vicfg-cfgbackup, and vmware-cmd. Finally, it details commands specific to the VMware vSphere Management Assistant (vMA) like vifp and vifp-target.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views18 pages

Vmware Vcap-Dca Cli Cheat Sheet v1.0

This cheat sheet provides concise summaries of Unix commands and VMware vSphere command line tools for the VCAP-DCA certification exam in 3 sentences or less: It lists common Unix commands like man, ls, cd, find, vi, cat, grep, more, tail, less, df, and ps. It also covers ESXi command line tools like esxcfg, vifs, vmkfstools, vicfg-hostops, vicfg-cfgbackup, and vmware-cmd. Finally, it details commands specific to the VMware vSphere Management Assistant (vMA) like vifp and vifp-target.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 18

1 VMware VCAP-DCA exam command-line cheat sheet

VMware Certified Advanced Professional Datacenter Administration exam cheat sheet.


VDCA410

version date by changes


1.0 29 April 2011 Ivo Beerens Initial draft
www.ivobeerens.nl
[email protected]

1.1 Unix commands

Command Description Example


man Show the help of the List the help for ls
command man ls

ESXi has no man


command
For ESXi use
command -help
ls List files and directories List files and directories long format
ls -l
cd Change directories Change the directory
cd /vmfs/volumes
watch Run a command at a watch ‘ps –ef | grep | wc –l “
specific interval.

pwd print name of pwd


current/working directory
find Find files on the filesystem Find *.delta.vmdk files
find /vmfs/volumes/ -iname
"*delta.vmdk"

Find *.vmsn files


find /vmfs/volumes/ -iname
"*.vmsn"
vi screen-oriented (visual) Edit file
display editor vi /etc/ntp.conf

Modes:
a / A = append
I / I = insert
o / O = open new line
r / R = replace

$ end of line
dd delete line

:wq write and quit (save)

nano Simple text editor Edit the ntp.conf


nano /etc/ntp.conf
not available in ESXi
cat Concatenate the contents List the content of the filename on the
of files and display the screen
content on the screen cat vmkernel.log
grep Find certain text string in a Find on the vmkernel.log the error text
file string
cat vmkernel.log | grep error
more Dislay the content of one List the error output page by page by
screen at a time. Use the pressing space or enter (line by line)
spacebar for the next cat vmkernel.log | grep error
screen | more

q = quit List the error of the vmkernel.log output


page by
more vmkernel.log
tail Output the last part of files Show the last 15 lines of the vmkernel.log
tail -15 vmkernel.log
less Display the contents of a less file
specified file one screen at
a time. Use the arrow keys
to move up and down
through the file
df / vdf Display the free space on Display the free space in human readable
the mounted mount points format (In MB of GB)
df -h
ps Show names, process IDs Shows all proccesses
and other information for ps –ef
running processes

1.2 ESX(i) command line commands

The following command line tools can be used:

 VMware vSphere Command-Line Unterface (vCLI), Installs the vSphere SDK for Perl on
Windows or Linux
 Local Console (VMware ESX or ESXi) esxcfg
 VMware vSphere Management Assistant (vMA) vicfg
 VMware vSphere PowerCLI
Some Service Console commands will not work on ESXi. For example esxcfg-vswif is replace with
vicfg-vmknic

In Lockdown mode (disables all direct root access to ESXi hosts) some commands are not possible
such as commands that support the –vihost option. The following commands cannot run against
vCenter and therefore not available in lockdown mode:
 vicfg-snmp
 vifs
 vicfg-user
 vicfg-cfgbackup
 vihostupdate
 vmkfstools
 esxcli
 vicfg-ipsec

1.3 vMA commands

Command Description Examples


vifp Adds an ESX(i) servers to Add server
(vi-fastpass) the vMA vifp addserver servername

addserver List server(s)


removeserver vifp listservers
rotatepassword
listservers Remove servers
Vifp removeserver servername
vifp-target Specify ESX(i) server Initialize vi-fastpass Specify server
vifptarget –-set esxi-02

(vifp-init) Resets server


vifptarget –-clear
1.4 vSphere (v)CLI commands

Most of the commands can be used on VMware ESX(i) on the local console by using esxcfg- instead
of using vicfg- (vCLI and vMA).

Command Description Examples


vicfg-hostops You can use maintenance Enter host in maintenance mode
mode, shut down or reboot vicfg-hostops --operation
an ESX/ESXi host enter
Exit maintenance mode
vicfg-hostops --operation exit

Reboot host
vicfg-hostops <conn_options>
--operation reboot --force

vicfg-cfgbackup back up and restore the You can back up configuration data by
ESXi host configuration running vicfg-backup with the -s option.
data vicfg-cfgbackup <conn_options>
-s /tmp/ESX_181842_backup.txt

Restore ESXi configuration data


vicfg-cfgbackup <conn_options>
-l /tmp/ESX_181842_backup.txt
vmkfstools create and manage a virtual Create a 10GB VMDK (defaults to
machine file zeroedthick with a BUSLOGIC adapter.
vmkfstools –c 10GB <path to
-X extend (use the entire VMDK>
new size, not the
increment) Extend the virtual disk to 10GB
m or M = megabytes vmkfstools –X 10g <path to
g or G = gigabytes VMDK>
-E rename
-U delete Query VMFS
-E Rename vmkfstools –P <path to VMDK>
-c create
-i clone
vifs view and manipulate files List the content of the datastore iSCSI-1
on remote ESX/ESXi hosts vifs -D [iSCSI-1]
directly
Move a file into a virtual machine
directory.
vifs --move '[osdc-cx700-03]
vcli_test/test_doc'
'[osdc-cx700-03] winxpPro-
sp2/test_doc
svmotion moves a virtual machine’s The command prompts you for
configuration file, and, the information it needs to complete the
Command Description Examples
optionally, its disks, while storage migration
the svmotion --interactive
virtual machine is running.
vmware-cmd manage virtual machines List all registered VMs configuration files
vmware-cmd -l
perform operations on a
virtual machine such as register to add the virtual machine to the
powerstate, register, inventory
unregister and manage vmware-cmd -s
snapshots
vicfg-mpath configure and manage List all devices with their corresponding
storage multipathing paths, state of the path, adapter type, and
For for ESX/ESXi 3.5 use other information.
vicfg-mpath35 vicfg-mpath -l

Display a short listing of all paths.


vicfg-mpath --list-compact

List all multipathing plugins loaded into


the system.
vicfg-mpath --list-plugins

Set path by using


esxcli <conn_options> nmp
device setpolicy --device
naa.xxx --psp VMW_PSP_RR

See the SATPs


vicfg-mpath -G
vicfg-vmknic Adds, deletes, and modifies Enable IPv6
virtual network adapters vicfg-vmknic -6 true
(VMkernel NICs). List
vicfg-vmknic –list

Add VMkernel for iSCSI


vicfg-vmknic --add --ip
172.16.1.200 --netmask
255.255.255.0 -p "iSCSI-1"
-mtu 9000

vicfg-vswitch Adds or removes virtual vSS


switches or vNetwork
Distributed Switches, or Unlink an uplink
modifies vicfg-vswitch –U <vmnic>
switch settings. <vSwitch>

link an uplink
vicfg-vswitch –L <vmnic>
<vSwitch>

Enable CDP
Command Description Examples
vicfg-vswitch –B vSwitch0

Create switch
vicfg-vswitch -a vSwitch0

Add jumbo frames


vicfg-vswitch --mtu 9000
vSwitch0

Create portgroup
vicfg-vswitch -add-pg iSCSI-1
vSwitch0

ADD Pnic to vSwitch


vicfg-vswitch -L vmnic5
vSwitch0

vDS

Add an uplink adapter to a distributed


virtual port
–add-dvp-uplink | –P

Deletes an uplink adapter from a port on


the distributed virtual switch.
–del-dvp-uplink | –Q
<adapter_name> –dvp
<DVPort_id><dvswitchname>

Name of a distributed virtual port


–dvp | -V

unlink an DVS uplink


vicfg-vswitch –Q <vmnic> - V
<dvport ID or vmnic>
<dvswitch>

adds an DVS uplink


vicfg-vswitch –P <vmnic> - V
<dvport ID or vmnic>
<dvswitch>
net-dvs is a debugging utility for
Distributed vSwitch
vicfg-snmp Manages SNMP Set SNMP
vicfg-snmp –server <hostname>
–username <username> –password
<password> -t target
address>@<port>/<community>

vicfg-snmp –server esxi-02 –t


vcenter/public
Command Description Examples

Enable SNMP
vicfg-snmp –server <hostname>
–username <username> –password
<password> –enable

Send test trap


vicfg-snmp –server <hostname>
–username <username> –password
<password> -p <port>

vicfg-volume supports resignaturing a see a list of copied volumes


snapshot volume and vicfg-volume –l
mounting and unmounting
the volume. resignature the volume
vicfg-volume –r <previous VMFS
label | UUID

mount the volume without resignaturing


esxcfg-volume –M <previous
VMFS label | UUID

vicf-advcfg offers a number of low- Enable OEM CIM providers as follows:


level advanced options. vicfg-advcfg <conn_options> -s 1
CIMOEMProvidersEnabled
vicfg-module setting and retrieving Run vicfg-module --list to list the modules
VMkernel module options on the host.
vicfg-module <conn_options>
--list

Configures a supported network interface


to use NetQueue.
vicfg-module <conn_options>
--set-options 'intr_type_2
rx_ring_num=8' s2io

Verifies that the NetQueue module is


configured.
vicfg-module <conn_options>
--get-options s2io
esxtop / resxtop Realtime monitoring Batch mode
ESX(i) statistics Allows collection that will be captured to a
file.
Default configuration file = esxtop –b > file.csv
.esxtop4rc
Load esxtop with config file
resxtop has no fastpass esxtop –c <config_file>

f = Edit fields to display Replay mode


v= view VM stats only Esxtop will replay resource utilization
W = Save config file stats that were collected using the vm-
Command Description Examples
support command. The capture from the
vm-support command would have been
generated by the following command
vm-support –s –d duration –I
interval

You would then unzip/untar this for


esxtop –R <path to dir>
vscsistats gather storage performance Find IDs of the VMs
data vscsistats –L
Start monitoring
only available on vscsistats –S –W id
ESX/ESXi, not in vMA Display
vscsistats –P all –W id
Stop monitoring
vscsistats –x

esxcli Configure iSCSI, LIST SATP


Multipathing and list, stop esxcli nmp satp list
(doesn’t work with vi- VMs
fastpass) LIST PSP
Configure multipathing esxcli nmp psp list
vicfg-scsidevs –
vmfs (list ID naa.) set path policy Configure the default PSP for a SATP
esxcli nmp satp setdefaultpsp
NMP (native Multipathing –psp VMW_PSP_RR –satp
plugin) VMW_SATP_DEFAULT_AA

SATP (Storage Array Type Change a specific path


Plugin) = path failover esxcli nmp device setpolicy
--device naa.xxx --psp
PSP (Path Selection VMW_PSP_RR
Plugin) = load balancing
policy Viewing the multipathing policy
MRU, Fixed, Round esxcli –server <host>
Robin, Fixed_AP --username root –password
<password> nmp device list

To set round robin use – Retrieve path selection settings for a


bytes or –iops device that is using the roundrobin PSP.
esxcli <conn_options> nmp
Default 1000 iops roundrobin getconfig --device
na.xxx

Sets the device specified by --device to


switch to the next path each time 12345
bytes have been sent
along the current path.
esxcli <conn_options> nmp
roundrobin setconfig
--type=iops --iops 4200
Command Description Examples
--device naa.xxx

Sets the device specified by --device to


switch to the next path each time 1 iop
have been sent
along the current path.
esxcli nmp round robin setconfig –type
“iops”-iops 1 –device naa.

EMC
esxcli nmp satp setdefaultpsp
–psp VMW_PSP_RR –satp
VMW_SATP_SYMM

iSCSI port binding iSCSI

 Create multiple Connect vmk1 to vmhba33


VMkernel ports esxcli swiscsi nic add -n vmk1
 Configure each -d vmhba33
VMkernel port for
a dedicated pNIC esxcli swiscsi nic add –n
(other pNICS <port_name> –d <vmhba>
unused)
 Bind each Display configuration
esxcli swiscsi nic list
VMkerne; port to
the iSCSI initiator
 Rescan storage
Rescan storage
 Enable iSCSI vicfg-rescan vmhba33

List All running VMs


esxcli vms vm list

Stop the virtual machine by running the


following command.
esxcli vms vm kill --type
<kill_type> --world-id <ID>
vmware-umds VMware Update Manager Configure to only download the host
Download Service patches
vmware-umds.exe --set-config –
enable host 1 –enable win 0 –
enable

Start downloading patches


vmware-umds.exe --download

Set the path where the patches will be


stored
vmware-umds.exe --set-config –
path c:\download
Command Description Examples

Export patches to VUM


vmware-umds.exe –E –
exportstore path
vicfg-syslog All ESX/ESXi hosts run a Run vicfg-syslog --show to display the
syslog service (syslogd), syslog server configuration.
which logs messages from vicfg-syslog -i
the VMkernel and other
system Run vicfg-syslog --setserver to set a remote
components to a file. server as the syslog server.
vicfg-syslog -s mysyslogserver

Run vicfg-syslog --setport to set the port


for the syslog server.
vicfg-syslog -p <port>

vilogger Collect ESX/ESXi logs to Enables log collection for the testserver
the vMA vMA target using default values for
collection period, log rotation,
ESX logs collected: and log size.
messages vilogger enable –server
vmkernel testserver
vmksummary
vmkwarning Enable log collection for all vMA targets
hostd.log using default values for collection period,
vpxa.log log rotation,
vilogger enable
ESXi logs collected:
Messages diable vilogger
Hostd.log vilogger disable
Vpxa.log

vCenter logs collected:


vpxd.log

Defaults:
collectionperiod =
10
maxfilesize = 5MB
numrotations = 5

Logs are default placed


under /var/logl/vmware on
the vMA

vicfg-dns change/update DNS Specify the DNS server using the --dns
option and a comma‐separated list of
hosts, in order of
preference.
vicfg-dns <conn_options --dns
Command Description Examples
<dns1,dns2>
vicfg-nics Manages the ESX/ESXi List settings.
host’s NICs (uplink vicfg-nics -l
adapters).
Set vmnic2 to auto‐negotiate its speed and
duplex settings.
vicfg-nics <conn_options> -a
vmnic2
vicfg-ntp Specifies the NTP Run vicfg-ntp --start to start the service.
(Network Time Protocol) vicfg-ntp --start
server
Add NTP server.
vicfg-ntp -a 192.168.250.2
vicfg-route Lists or changes the add a route to 192.168.100.0 through
ESX/ESXi host’s route 192.168.0.1
entry (IP gateway) vicfg-route -a
192.168.100.0/24 192.168.0.1

vicfg-iscsi configuration and property Enable iSCSI


retrieval for software or Esxcfg-swiscsi –e (enable
hardware iSCSI initiators. iSCSI)

-D --discovery Determine the HBA type and retrieve the


-S --static HBA ID.
-A vicfg-iscsi --adapter –list
--authentication
-P --phba With static discovery, you must specify the
-T --target host name or IP address and the iSCSI
-L --lun name of the storage
-N --network target. You run the following command:
(Independent vicfg-iscsi <conn_options>
hardware iSCSI --static –add --ip <ip_addr |
only) domain_name>
-p --pnp --name <iscsi_name>
(Independent <adapter_name>
hardware iSCSI
only)
-I --iscsiname
-W --parameter
-E --swiscsi
-H --adapter
Suboption is one
of the following
operations:
-l --list
-a --add
-r --remove
vmkiscsi-tool Enable,rescan Vmkiscsi-tool –D –a 10.0.0.1:3260 vmhba33
vmkping VMkernel ping vmkping –d –s 9000 <ip address or
destination>
vicfg-nas manipulates NAS file List all known NAS file systems.
Command Description Examples
systems associated with vicfg-nas –l
ESX/ESXi hosts
Add a new NAS file system to the
-d delete NAS mount point ESX/ESXi host.
vicfg-nas --add --nasserver
dir42.eng.vmware.com -s
/<mount_dir>nfsstore-dir42
vicfg-rescan Perform a rescan operation Run vicfg-rescan, specifying the adapter
each time you reconfigure name.
your storage setup vicfg-rescan vmhba1
vicfg-scsidevs displays information about List all logical devices known on this
available LUNs on system with detailed information.
ESX/ESXi 4.x hosts. vicfg-scsidevs -list

Print mappings for VMFS volumes to the


corresponding partition, path to that
partition, VMFS uuid,
extent number, and volume names.
vicfg-scsidevs –vmfs

Print HBA devices with identifying


information.
vicfg-scsidevs -hbas
vicfg-firewall Manage the Service Enable/Disable pre-configured services
Console firewall esxcfg –e service
esxcfg –d service
Only for VMware ESX!
Allow syslog outgoing traffic
-q query esxcfg-firewall -o
-o open port 514,udp,out,syslog

Close a port
esxcfg-firewall –c
514,udp,out,syslog

View security level


esxcfg-firewall –q incoming o
esxcfg-firewall –q outgoing

Set medium security


esxcfg-firewall –-
allowOutgoing –-blockIncoming

Set low security


esxcfg-firewall -–
allowIncoming –allowOutgoing

Set high security (default)


esxcfg-firewall -–
blockIncoming –blockOutgoing
vm-support Creates support bundle Creates Support bundle
Command Description Examples
vm-support
vihostupdate The vihostupdate command Verify that the bulletins are installed on
applies software updates to your ESX/ESXi host.
For ESXi 3.5 host use ESX/ESXi images and vihostupdate <conn_options>
Vihostupdate35 installs and updates --query
ESX/ESXi extensions such
as VMkernel modules, Adds a packages to an ESXi server
drivers, and CIM providers. vihostupdate.pl --server <IP
address of ESXi 4 host> -i -b
<name.zip>

vicfg-user create, modify, delete, List the existing users.


and list local direct access vicfg-user -e user -o list
users and groups of users
on an ESX/ESXi host Add a new user, specifying a login ID and
password.
If you create a user without vicfg-user -e user -o add -l
specifying the role (--role), user27 -p 27_password
the user has no
permissions. Add group40 to the existing groups. If you
do not specify a group ID, the system
assigns an ID for the
group.
vicfg-user <conn_options> -e
group -o add -d group40 -D 55

1.5 High Availiability (HA) attributes:

HA advanced attributes Description Examples


das.slotcpuinmhz Defines the das.vmCpuMinMHz = <value>
maximum bound on
the CPU slot size. If
this
option is used, the
slot size is the
smaller of this value
or the
maximum CPU
reservation of any
powered-on virtual
machine in the
cluster.

Default 256MHz
das.slotmeminmb Defines the
maximum bound on
HA advanced attributes Description Examples
the memory slot size.
If this
option is used, the
slot size is the
smaller of this value
or the
maximum memory
reservation plus
memory overhead of
any powered-on
virtual machine in the
cluster.
das.usedefaultisolationaddress By default, VMware das.usedefaultisolationadd
HA uses the default ress = false
gateway of the
console network as
an isolation address.
This attribute
specifies whether or
not this default is
used (true|false).
das.failuredetectiontime Changes the default das.failuredetectiontime =
failure detection time 60000
for host
monitoring. The
default is 15000
milliseconds (15
seconds).
This is the time
period, when a host
has received no
heartbeats from
another host, that it
waits before
declaring
that host as failed.
das.isolationaddress[...] Sets the address to das.isolationaddress1 to
ping to determine if a das.isolationaddress10 =
host is isolated from <value>
the network. This
address is pinged
only when heartbeats
are
not received from any
other host in the
cluster. If not
specified, the default
gateway of the
management network
is used. This default
HA advanced attributes Description Examples
gateway has to be a
reliable address that
is available, so that
the host can
determine if it is
isolated from
the network. You can
specify multiple
isolation addresses
(up to 10) for the
cluster:
das.isolationaddressX
, where X =
1-10. Typically you
should specify one
per management
network. Specifying
too many addresses
makes isolation
detection take too
long.
das.failuredetectioninterval Changes the
heartbeat interval
among VMware HA
hosts. By
default, this occurs
every 1000
milliseconds (1
second).
das.preferredPrimaries Select the primary das.preferredPrimaries =
HA hosts 172.16.1.1,
172.16.1.2,172.16.1.3
This setting is
unsupported!

NOTE If you change the value of any of the following advanced attributes, you must disable and
then re-enable VMware HA before your changes take effect.
 das.isolationaddress[...]
 das.usedefaultisolationaddress
 das.failuredetectiontime
 das.failuredetectioninterval
 das.isolationshutdowntimeout

For all HA advanced attributes see the vsp_41_availability PDF


1.6 Basic PowerCLI command

Command Description Examples


set-ExecutionPolicy Set the scripts allowed to Allow the execution of all local
execute. Policies: scripts
 Restricted Set-ExecutionPolicy
 AllSigned remotesigned
 RemoteSigned
 Unrestricted

add-PSSnapin Add the VMware


VMware.VimAutomation.Core PowerCLI functionality to
the Powershell
environment
add-PSSnapin ADD the VMware Update
VMware.VUMAutomation Manager CMDlets
connect-viserver Connect to ESX(i) or Connect to vCenter host
vCenter host connect-viserver
vcenter01
disconnect-viserver Disconnect from ESX(i) or Disconnect from vCenter host
vCenter host disconnect-viserver
vcenter01
get-vm List all VMs on the ESX(i) List all VMs
or vCenter server Get-vm

List all VMs with the name


DC01
Get-vm “DC01”
get-command List all the Powershell Get-command
commands available
get-member List all properties and List all properties and methods
methods for the DC01 VM
Get-vm “DC01”| get-
member
where-object Using filters List all VMs that have more
than 1 CPU
Get-VM | where-object
{$_.numcpu –gt 1}
get-help Gets help on a specific List all cmdlets with *vmotion*
cmdlet in it.
Get-help *vmotion*
Show the examples of the cmdlet
get-vm
Get-help get-VM
-Examples
Get-powerCLIVersion Get the version of Get-powerCLIVersion
PoweCLI

You might also like