Top 4 – ESXi one-liner scripts

bash-148836_960_720I have caught myself quiet a few times running a bunch of one-liner scripts on ESXi.
Whether I setup ESXi, troubleshoot something or just test a feature, one-liners can often simplify whatever task you’re trying to complete.

Below is the list of one-liner scripts, which I use at least once a week.

 

Register all VMs, from a datastore, back to the ESXi Inventory

find /vmfs/volumes/ -name "*.vmx" -exec  vim-cmd solo/registervm {} \;

Identify whether ESXi is booting of USB

esxcli storage core device list | grep 'Is Boot USB Device:' | awk '{ if($5=="true") {print "Found a usb boot device"}}'

Number of vmknics with jumbo frames configured

esxcfg-vmknic -l | grep -Eo '[0-9]{1,}' | awk '{ if ((length($1) == 4 ) && $1 >= 9000 && $1 <= 9216) print}' | wc -l

Number of powered-on VMs

esxcli vm proces list | grep "World ID:" | awk '{print $3}' | wc -l

 

I will share some of my most used PowerCLI scripts, early next 2016.

 

 

One thought on “Top 4 – ESXi one-liner scripts”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.