I’m on WINDOWS 10 and use POWERSHELL 7.4.2.
My script writes documentation-files for each module-script (.psm1) as Markdown-files (.md). I can get access with Get-Help to every commentHelp-keyword but OUTPUT and NOTES.
This is how I get access to the commentHelp-sections of a module-file:
# extract AST from source-file
$tokens = §null
$errors = $null
$ast = [System.Management.Automation.Language.Parser]::ParseFile($sourceFile, [ref]$tokens, [ref]$errors)
# get data of all functions in file
$functionDefinitions = $ast.FindAll( {
param([System.Management.Automation.Language.Ast] $ast)
$ast -is [System.Management.Automation.Language.FunctionDefinitionAst] -and ($PSVersionTable.PSVersion.Major -lt 5 -or $ast.Parent -isnot [System.Management.Automation.Language.FunctionMemberAst])
}, $true)
I can access the keywords in the commentHelp of each function (.SYNOPSIS, .DESCRIPTION, .PARAMETER, .EXAMPLE …) by the Get-Help command
$functionDescription = (Get-Help -Name $functionDefinition.Name).Description
where $functionDefinition.Name is the object with the commentHelp-content of a single function.
$examples = Get-Help -Name $FunctionDefinition.Name -Examples
gives me the object with all examples.
Looking at the commentHelp-object with
$functionDescription | format-list
displays all commentHelp-keywords and their values properly. The values of OUTPUTS, NOTES and ROLE are present as strings. But the Get-Help commands for OUTPUTS and NOTES deliver a null-value, ROLE works fine.
There are no execution-errors when parsing the commentHelp, just no values for OUTPUTS and NOTES.
Is there anything special with OUTPUTS and NOTES? Does anyone have a solution for this issue?
Peace and keep healthy