Documenting PowerShell script for Get-Help
In this recipe, we will use header comments that can be utilized by the Get-Help cmdlet.
How to do it...
In this recipe, we will explore comment-based Help.
Open PowerShell ISE. Go to Start | Accessories | Windows PowerShell | Windows PowerShell ISE.
Add the following:
<# .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 "QUERYWORKS\SQL01" -databaseName "pubs" .EXAMPLE PS C:\PowerShell> .\Backup-Database.ps1 -instance "QUERYWORKS\SQL01" -database "pubs" .NOTES To get help: Get-Help .\Backup-Database.ps1 #> param ( [Parameter(Position=0)] [alias("instance")] [string...