'PowerShell report what functions are loaded from a script

I have a number of scripts downloaded from the internet, and they only contain function definitions, i.e. not constructed as Modules. Hence, if I run these scripts, there is no output. If I dotsource these scripts, there is still no output, but the functions in the scripts are loaded into the session.

Is there a way that I could perform a dotsource on a script and at the same time report back visually what was loaded from that script? e.g., something like this:

Function "<name>" was loaded from .\script1.ps1
Function "<name>" was loaded from .\script1.ps1
Alias "<name>" was loaded from .\script1.ps1
...

Then, I could load a bunch of scripts, visually see what was loaded, and then be able to interrogate each function or alias with Get-Help if I needed more information (if they have .SYNOPSIS and other parameters defined within them for that purpose, that is)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source