Hello vCommunity,

 

Here is a simple script to gather the ESXi Version as well as its uptime and hostname,

Regular Script

[[email protected]:~] sh esxr.sh

or Script With the VxRail Output

[[email protected]:~] sh esxv.sh

 

Outputs:

Regular Script

=============ESXi version==============
   Hostname: jortech-node01.vsphere.local
   Uptime:  3 days, 03:59:24
   Product: VMware ESXi
   Version: 6.7.0
   Build: Releasebuild-11675023
   Update: 1
   Patch: 39
=======================================

Script With the VxRail Output

=============ESXi version==============
   Hostname: jortech-node01.vsphere.local
   VxRail Code: 4.7.100-11859440
   Uptime:  3 days, 04:05:48
   Product: VMware ESXi
   Version: 6.7.0
   Build: Releasebuild-11675023
   Update: 1
   Patch: 39
=======================================

Regular Script (Without the VxRail version output):

#!/bin/sh
# Script to gather esxi version, uptime and hostname
# Author: Jorluis Perales, VxRail SST @ Dell EMC
# Version 1.0
#
# Do not change anything below this line
# --------------------------------------

echo "=============ESXi version=============="
echo "   Hostname:" $(hostname)
echo "   Uptime: " $(uptime | cut -d, -f1,2 | cut -c14-)
esxcli system version get
sleep 2
echo "======================================="

Script (With the VxRail version output):

#!/bin/sh
# Script to gather esxi version, uptime and hostname
# Author: Jorluis Perales, VxRail SST @ Dell EMC
# Version 1.0
#
# Do not change anything below this line
# --------------------------------------

echo "=============ESXi version=============="
echo "   Hostname:" $(hostname)
echo "   VxRail Code:" $(esxcli software vib list | grep "vmware-marvin" | awk '{print $2}')
echo "   Uptime: " $(uptime | cut -d, -f1,2 | cut -c14-)
esxcli system version get
sleep 2
echo "======================================="

Here is the GitHub access to these scripts

Make sure to review the VMware Scripting Series to find more useful content.

Jorluis

Buy me a coffeeBuy me a coffee