Professional Documents
Culture Documents
me/reset-esxi-evaluation-license/
Calvin Bui
Home Topics Donate
The ESXi 6 evaluation license is valid for 60 days and a free one can be obtained from
VMware at anytime. Resetting the evaluation license provides continual access to all the
features available, and most importantly for me, full compatibility with the ESXi Embedded
Host Client.
Commands
1 of 7 7/2/2018, 3:02 PM
Reset ESXi 6 Evaluation License (cron script included) | Calvin Bui https://calvin.me/reset-esxi-evaluation-license/
Note: Running these commands will cause ESXi to appear offline/down. For example, my
UPS virtual machine connected to my actual UPS began shutting down VMs because it
believed ESXi ran into a problem. Shut down those VMs firstly before running this
command then bring them back up later.
1 $ rm -r /etc/vmware/license.cfg
Copy over the new evaluation license, which is already on the host
1 $ cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg
1 $ /etc/init.d/vpxa restart
Automatic Script
The commands above can be run automatic to keep your ESXi license reset on a set
schedule using cron.
I have also created a script which powers off and on a VM of your choice (such as a UPS
agent) in case it shuts down the host.
First create the script (reset-eval.sh) somewhere accessible to ESXi. I chose to put in my
ZFS0 datastore (/vmfs/volumes/ZFS0/reset.eval)
1 #!/bin/sh
2 of 7 7/2/2018, 3:02 PM
Reset ESXi 6 Evaluation License (cron script included) | Calvin Bui https://calvin.me/reset-esxi-evaluation-license/
2 ## remove license
3 echo 'Removing License'
4 rm -r /etc/vmware/license.cfg
5 ## get a new trial license
6 echo 'Copying new license'
7 cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg
8 ## restart services
9 echo 'Restarting VPXA'
10 /etc/init.d/vpxa restart
This alternative script shuts down any VM called ‘ups-agent’. You may edit that line to your
VM’s name
1 #!/bin/sh
2
3 # This script shuts down the UPS-Agent and resets the license
4 echo 'Getting VMID of UPS-Agent'
5 vmid=$(vim-cmd vmsvc/getallvms | grep ups-agent | awk '{print $1}')
6 echo 'VMID is' $vmid
7
8 echo 'Getting UPS-Agent Power state'
9 state=$(vim-cmd vmsvc/power.getstate $vmid | grep Powered)
10 echo 'VM is currently' $state
11 x=1
12
13 while [[ "$state" == "Powered on" && $x -lt 3 ]]
14 do
15 echo 'Powering off...'
16 vim-cmd vmsvc/power.shutdown "$vmid"
17 echo 'Waiting for VM to power off...'
18 i=30;while [ $i -gt 0 ];do if [ $i -gt 9 ];then printf "bb$i";else
3 of 7 7/2/2018, 3:02 PM
Reset ESXi 6 Evaluation License (cron script included) | Calvin Bui https://calvin.me/reset-esxi-evaluation-license/
Test the script and make sure it works (remember to chmod +x)
1 $ chmod +x reset-eval.sh
2 ./reset-eval.sh
4 of 7 7/2/2018, 3:02 PM
Reset ESXi 6 Evaluation License (cron script included) | Calvin Bui https://calvin.me/reset-esxi-evaluation-license/
Add the script to the crontab to make it run on a set schedule (mine is set at 6:05am each
day). For each 59 days do ‘* * 59 * *’
Finally add the following to the end of ‘/etc/rc.local.d/local.sh’ to regenerate the job as ESXi
clears the crontab on reboot
5 of 7 7/2/2018, 3:02 PM
Reset ESXi 6 Evaluation License (cron script included) | Calvin Bui https://calvin.me/reset-esxi-evaluation-license/
LOG IN WITH
OR SIGN UP WITH DISQUS ?
Replace the licence file using the .#license file (see above for filename and
location). All I did was remove the host from vcenter and readd it. All works and no
reboot needed.
ginettanyk
• Reply • Share ›
−
6 of 7 7/2/2018, 3:02 PM
Reset ESXi 6 Evaluation License (cron script included) | Calvin Bui https://calvin.me/reset-esxi-evaluation-license/
7 of 7 7/2/2018, 3:02 PM