This script can be used to collect user logon duration from multiple computers. You can also use the data to generate a report. The user logon duration calculation is based on the general algorithm, Logon duration = Logoff date time – Logon date time. In a real world, IT Administrators may need to collect user logon duration from multiple computers. User logon duration data can be useful when IT Administrators are troubleshooting some issues.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery