Finding All Variables in a Script

In the previous tip we illustrated how you can analyze the content of a script block and search for variables or commands. The same is possible for text-based scripts. The script below will analyze itself and dump variables and commands: