Using Comment-Based Help

by Nov 6, 2009

PowerShell v.2 allows your functions to seamlessly integrate with the built-in PowerShell Help system. All you need to do is a Comment-Based- Help block into each function:

function Test-Me($parameter) {
A useless function
This function really does nothing
Demonstrates comment based help
Test-Me "Hello World"

Once you run this function, PowerShell will know where to look for Help, and you can use the built-in Get-Help to display the information in pretty much the same way as it already works for cmdlets:

Get-Help Test-Me
Get-Help Test-Me -examples

Twitter This Tip! ReTweet this Tip!