Documenting PowerShell script for Get-Help

In this recipe, we will take a look at how to use header comments in your script. Formatting the header comments in a specific way will enable them to be utilized by the Get-Help cmdlet.

How to do it...

In this recipe, we will explore the comment-based help:

  1. Open PowerShell ISE as an administrator.
  2. Add the following script:
    <# .SYNOPSIS Creates a full database backup .DESCRIPTION Creates a full database backup using specified instance name and database name This will place the backup file to the default backup directory of the instance .PARAMETER instanceName instance where database to be backed up resides .PARAMETER databaseName database to be backed up .EXAMPLE PS C:\PowerShell> .\Backup-Database.ps1 -instanceName ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.