Maybe not as robust of a solution as you are looking for, but I have a simple script which runs immediately at the beginning of a task sequence as the first step (beginning time) and at the end of the task sequence as the last step (end time):
I just have a .csv file which the script adds a row with other task sequence variables like the TS Name, model of computer, specs of computer, assigned user (we capture this during OSD), etc.
Here's how to read TS variables with PowerShell: https://docs.microsoft.com/en-us/sccm/osd/understand/using-task-sequence-variables