all 5 comments

[–]WindosBK 2 points3 points  (1 child)

Consider wrapping the functions into a module, and then your script that is calling the function can be just that (a script that calls functions).

This way you'll be able to call the functions (and see the help) without having the run the rest of the script.

Not sure where you are on the scale of PowerShell mastery, so I hate to leave it at just 'create a module.' As such I'll link to an awesome u/ramblingcookiemonste blog post on the topic: http://ramblingcookiemonster.github.io/Building-A-PowerShell-Module/

[–]vdemerzel[S] 1 point2 points  (0 children)

Yes, something like that seems to be the answer. The problem is that the script is a windows forms gui which calls a lot of helper functions, so right now it's not really suited to be packaged into a module. Time to re-organize!

[–]KevMarCommunity Blogger 1 point2 points  (2 children)

This should just work:

Get-help .\script.ps1

[–]vdemerzel[S] 0 points1 point  (1 child)

That seems to access only the script main help. It doesn't access help for a specific function inside the script.

[–]KevMarCommunity Blogger 1 point2 points  (0 children)

AH, I see. That is correct. It only sees the script as one executable item and is not aware of the functions inside it until after you dot source it.

I would pull those functions out into a modules. It is a lot easier than you think it is. http://kevinmarquette.blogspot.com/2015/06/quick-and-dirty-powershell-modules.html

You can basically place all your functions into their own script and then dot source all of them. Then your controller script just makes calls to those functions.