Get List Of Functions From Script

Question:

If I have a .ps1 file with the following functions

How can I get a list of all those functions and invoke them?

I’d like to do something like this:

Answer:

You could use the Get-ChildItem to retrieve all functions and store them into a variable. Then load the script into to runspace and retrieve all functions again and use the Where-Object cmdlet to filter all new functions by excluding all previously retrieved functions. Finally iterate over all new functions and invoke them:

Source:

Get List Of Functions From Script by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply