Providing help for our script
Writing scripts is great fun, and we learn new things every time we write one. We include the new techniques or shortcuts, finish the script, put it to work, and then forget about it. The next time we look at it might be months or even years later, by which time we might well have forgotten how it works or why we wrote it the way we did. The answer to this is to write comprehensive help for the script, explaining how our script works and how to use it. This is even more important for scripts that we make available for other people to use.
In this section, we’re going to cover four ways of providing help. First, we’re going to briefly look at how we can comment our code to help ourselves and others. After that, we’ll look at creating comment-based help for use with the Get-Help
cmdlet. Then, we’re going to look at the Write-Verbose
cmdlet, and how we can use it to understand what the script is doing. Finally, we’ll...