The script is available for download from https://gallery.technet.microsoft.com//How-to-get-index-usage-3b7e71cf. You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.
This script will output three parts, one to get the result of server level logins and related roles, one to get the result of user databases’ users and related roles, one to get the result of object level permission of specific database.
This script can be used to get the following results:
Server level logins and related roles
User databases users and related roles
Object level permission of specific database
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery