Thursday, 22 August 2024

Reset ESXi 6 Evaluation License

Reset ESXi 6 Evaluation License (cron script included) December 17th, 2015 / 2 min read / Edit Virtualisation #cron#esxi#evaluation#license#reset#script Commands Automatic Script For testing and educational purposes only. 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 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. Turn on SSH and log in to the host. Remove the current license rm -r /etc/vmware/license.cfg Copy over the new evaluation license, which is already on the host cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg Restart ESXi services /etc/init.d/vpxa restart Confirm the new license 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) #!/bin/sh ## remove license echo 'Removing License' rm -r /etc/vmware/license.cfg ## get a new trial license echo 'Copying new license' cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg ## restart services echo 'Restarting VPXA' /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 #!/bin/sh # This script shuts down the UPS-Agent and resets the license echo 'Getting VMID of UPS-Agent' vmid=$(vim-cmd vmsvc/getallvms | grep ups-agent | awk '{print $1}') echo 'VMID is' $vmid echo 'Getting UPS-Agent Power state' state=$(vim-cmd vmsvc/power.getstate $vmid | grep Powered) echo 'VM is currently' $state x=1 while [[ "$state" == "Powered on" && $x -lt 3 ]] do echo 'Powering off...' vim-cmd vmsvc/power.shutdown "$vmid" echo 'Waiting for VM to power off...' i=30;while [ $i -gt 0 ];do if [ $i -gt 9 ];then printf "bb$i";else printf "bb $i";fi;sleep 1;i=`expr $i - 1`;done state=$(vim-cmd vmsvc/power.getstate $vmid | grep Powered) x=`expr $x + 1` done if [ "$state" == "Powered off" ] then ## remove license echo 'Removing License' rm -r /etc/vmware/license.cfg ## get a new trial license echo 'Copying new license' cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg ## restart services echo 'Restarting VPXA' /etc/init.d/vpxa restart #echo 'Restarting Services' #services.sh restart ## power on echo 'Powering on USP-Agent' vim-cmd vmsvc/power.on "$vmid" else echo 'Could not turn off UPS-Agent' fi echo 'Finished' Test the script and make sure it works (remember to chmod +x) $ chmod +x reset-eval.sh ./reset-eval.sh 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 * * /bin/echo "5 6 * * * /vmfs/volumes/ZFS0/reset-eval.sh" >> /var/spool/cron/crontabs/root kill $(cat /var/run/crond.pid) crond 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 /bin/kill $(cat /var/run/crond.pid) /bin/echo "5 6 * * * /vmfs/volumes/ZFS0/reset-eval.sh" >> /var/spool/cron/crontabs/root crond

Tuesday, 16 July 2024

Exporting mailbox PST off M365 / O365

 https://medium.com/@furkanakyol/microsoft-365-panel-%C3%BCzerinden-users-pst-export-nas%C4%B1l-yap%C4%B1l%C4%B1r-1318b43f5ecc


icrosoft 365 offers a range of services that make the daily work of businesses and individuals easier. These services include email, file storage, communication tools and many other applications. The user data of these services, especially email messages, can grow over time and this data may need to be backed up and archived. At this point, exporting users' PST files via the Microsoft 365 panel becomes a very important issue.

First, it’s important to understand what PST files are and why they need to be exported. PST files are Outlook data files that typically contain data such as email, calendar, contacts, and tasks. Exporting this data can be done for purposes such as backup, data migration, or archiving. Backing up and archiving data, especially related to user accounts, is essential to prevent data loss and to be able to access this data when needed.

It is very easy to export user PST files via Microsoft 365 panel. Here is a step by step guide on how to do this:

#Microsoft #Microsoft365