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:
- Open PowerShell ISE as an administrator.
- 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 "QUERYWORKS\SQL01" -databaseName "pubs" .EXAMPLE PS C:\PowerShell> .\Backup-Database.ps1 -instance "QUERYWORKS\SQL01" -database "pubs" .NOTES To get help: Get-Help...