In PS5.1 it seems to work fine if you put the PSScriptInfo *after* the comment-based help. I don't know if PSGallery supports it, but I have seen that the built-in powershell commands like `Test-ScriptFileInfo` successfully can parse the "PSScriptInfo" block after the comment-based help.
Example `c:\temp\MyScriptFile.ps1`
```lang-pwsh
<#
.SYNOPSIS
This is a synopsis.
.DESCRIPTION
My example script file.
.OUTPUTS
Logging messages
.NOTES
Some notes.
#>
<#PSScriptInfo
.VERSION 1.0.0
.GUID 47a13a19-ee03-4d1c-bdbf-6223db478629
.AUTHOR Pxtl
.COMPANYNAME Pxtl's company
.COPYRIGHT 2025
.PROJECTURI https://Pxtl.ca
.RELEASENOTES
- Initial release 1.0.0
#>
[OutputType([string])]
[CmdletBinding()]
param ()
process {
"Hello, world"
}
```
appears to support both `Get-Help` and `Test-ScriptFileInfo`
```lang-pwsh
Test-ScriptFileInfo C:\temp\MyScriptFile.ps1
```
yields
```text
Version Name Author Description
------- ---- ------ -----------
1.0.0 MyScriptFile Pxtl My example script file.
```
and
```lang-pwsh
Get-Help C:\temp\MyScriptFile.ps1 -Full
```
yields
```text
NAME
C:\temp\MyScriptFile.ps1
SYNOPSIS
This is a synopsis.
SYNTAX
C:\temp\MyScriptFile.ps1 [<CommonParameters>]
DESCRIPTION
My example script file.
PARAMETERS
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Logging messages
NOTES
Some notes.
RELATED LINKS
```
In order to get the parameter details, you apparently need to use the `-detailed` or `-full` switch, i.e., `Get-Help Add-Extension -detailed`. When I do that with your code from the first example, I get
```
PS D:\Scripts> Get-Help Add-Extension -detailed
NAME
Add-Extension
SYNOPSIS
Adds a file name extension to a supplied name.
SYNTAX
Add-Extension [[-Name] <String>] [[-Extension] <String>] [<CommonParameters>]
DESCRIPTION
Adds a file name extension to a supplied name.
Takes any strings for the file name or extension.
PARAMETERS
-Name <String>
Specifies the file name.
-Extension <String>
Specifies the extension. "Txt" is the default.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
REMARKS
To see the examples, type: "get-help Add-Extension -examples".
For more information, type: "get-help Add-Extension -detailed".
For technical information, type: "get-help Add-Extension -full".
```
The Microsoft documentation is not clear about this.