New Comment Help

If you follow my blog I’m sure you noticed that I post a lot of advanced functions and scripts. While I don’t expect every one to be developing advanced functions, the closer you can get the more powerful your work. With the Scripting Games approaching I thought I’d offer up a little something to help take your scripts to the next level and that is adding comment based help. This is a specially structured comment block that you can insert into your functions and scripts. The comment block is parsed by Get-Help to produce the same type of help output you see with cmdlets. But creating the help comment can be tricky so I wrote a script based wizard. Continue reading

Get-NumberedContent v2

I wasn’t completely satisfied with the updated version of my Get-NumberedContent function. You should still refer to the earlier post for details on how to use the function. But I had some issues with the previous version and realized there were a few bugs. I’ve since updated the Get-NumberedContent function.

Continue reading

Summary Judgment

While working on a new article for REDMOND magazine about PowerShell 2.0, I wanted to get some cmdlet information. I wanted an easy way to see a list of cmdlets for a given verb or noun. Of course that is easily done with Get-Command. However this only gives my the definition.

After a little experimenting I found that I could get the help synopsis with the actual Get-Help cmdlet, not the Help function. So combining the two gives me the results I need.

PS C:\> gcm -noun job | select Name,@{Name="Synopsis";Expression={(get-help $_).synopsis}} | ft -auto -wrap

Name        Synopsis
—-        ——–
Get-Job     Gets Windows PowerShell background jobs that are running
            in the current session.
Receive-Job Gets the results of the Windows PowerShell background jobs
            in the current session.
Remove-Job  Deletes a Windows PowerShell background job.
Start-Job   Starts a Windows PowerShell background job.
Stop-Job    Stops a Windows PowerShell background job.
Wait-Job    Suppresses the command prompt until one or all of the
            Windows PowerShell background jobs running in the
            session are complete.

This should work for most Get-Command expressions. Although you may need to tweak a bit. Here’s my solution for discovering about aliases:

PS C:\> gcm -type alias | select Name,ResolvedCommandName,@{Name="Synopsis";Expression={(get-help $_).synopsis}} | ft -wrap -auto

Have fun.