Latest Posts


Total Pageviews

Monday, 6 October 2014

How to Format ESXCLI Command Output

In this demo i will show how to format esxcli command Output. As from the vSphere5.x you can format esxcli command Output Many ESXCLI commands generate output you might want to use in your application. You can run esxcli with the --formatter dispatcher option and send the resulting output as input to a parser.
The --formatter options supports three values csv, xml, and keyvalue and is used before any namespace.

1. This screenshot is output of this command:-
esxcli storage  filesystem list

2. Now if you want to format this output then you should know fields name so with this command you can get the fields name
esxcli --formatter=csv  storage filesystem list
3. Now i will use fields name from this command to format the esxcli output to show only UUID and VolumeName
esxcli --formatter=csv --format-param=fields="UUID,VolumeName"  storage filesystem list

You can also format it with these values:-
esxcli --formatter=keyvalue  storage filesystem list
esxcli --formatter=xml  storage filesystem list