Scripting Tips & Tricks: Review Your Comments

I wrote a PowerShell module recently as part of an update to a service we provide to customers. I needed to dump out all of the comments so they could be submitted for review. I wanted to ignore comment based help sections.


Here's how I did it with the aid of RegEx...


$a = gc "X:\Dev\Modules\BOOM\BOOM.psm1"

$a | select-string -Pattern "^\s*#[^#>]"



The same technique could be used to check another module, a lengthy script or a detailed advanced function. Have fun!