Examples

Get-Help expects examples to start with one or more lines of code, followed by a description of the example, for example:

function Get-Something {
<#
.SYNOPSIS
Briefly describes the main action performed by Get-Something
.DESCRIPTION
A detailed description of the activities of Get-Something.
.EXAMPLE
$something = Get-Something
$something | Do-Something

Gets something from somewhere.
#>

param (
# Describes the purpose of Parameter1.
$Parameter1,

# Describes the purpose of Parameter2.

$Parameter2
)
}

The help parser is quite simple when it comes to comment-based help. Only the very first line of an example is considered to be code. This can be demonstrated by exploring the object returned by Get-Help based on the preceding example:

PS> (Get-Help Get-Something -Examples).examples[0].example.code
$something = Get-Something

The rest of the code is part of the remark. It is only possible to overcome this parsing problem by writing help in MAML.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.235.227