PowerShell: Comment Based Help Generation
Here is a quick couple of functions I put together which will use AST to pull all the functions, their parameters, and associated parameter attributes and create a template comment based help from the results.
I’d been meaning to put this one together for a little while now. If you ever hacked together a bunch of PowerShell code and had to go back later and add comment based help you already know how tedious the process can be. This function should make it slightly less cumbersome. It pulls the ‘HelpMessage’ parameter attributes and automatically populates the parameter sections of a CBH comment block string.
Just pipe your code in raw form into this function to get an array of psobjects containing function names and comment based help strings in return. This only works for fully defined functions right now (my primary use case). It will take some modification to get it to work on script file based parameters. Anyway, the code is in my github repository as well as below.