I am trying to use the Get-Help cmdlet to display comment-based help in the same format in which it displays the cmdlet help topics that are generated from XML files. The ability to do this is documented in about_Comment_based_Help on TechNet, but when I execute the get-help cmdlet against my script I only get the script name returned. Any help would be appreciated!
PS C:\Admin> Get-Help .\checksystem.ps1 -full
checksystem.ps1
checksystem.ps1 script:
function IsAlive {
<#
.DESCRIPTION
Checks to see whether a computer is pingable or not.
.PARAMETER computername
Specifies the computername.
.EXAMPLE
IsAlive -computername testwks01
.NOTES
This is just an example function.
#>
param (
$computername
)
Test-Connection -count 1 -ComputerName $computername -TimeToLive 5 |
Where-Object { $_.StatusCode -eq 0 } |
Select-Object -ExpandProperty Address
}
IsAlive -computername 192.168.1.1
The Get-Help cmdlet displays information about PowerShell concepts and commands, including cmdlets, functions, Common Information Model (CIM) commands, workflows, providers, aliases, and scripts. To get help for a PowerShell cmdlet, type Get-Help followed by the cmdlet name, such as: Get-Help Get-Process .
You can type a comment symbol # before each line of comments, or you can use the <# and #> symbols to create a comment block. All the lines within the comment block are interpreted as comments.
The Get-Help cmdlet displays information about Windows PowerShell concepts and commands, including cmdlets, functions, CIM commands, workflows, providers, aliases and scripts. To get help for a Windows PowerShell command, type `Get-Help` followed by the command name, such as: `Get-Help Get-Process`.
The Get-Help cmdlet displays the script and function help topics in the same format as it displays help for cmdlets, and all of the Get-Help parameters work on script and function help topics. PowerShell scripts can include a help topic about the script and help topics about each functions in the script.
It will work, but you are trying to run get help on the script. You have added the help to the function. If you dot source your script, and then type get-help isalive, you will see your help for the function.
. .\checksystem.ps1 ; get-help isalive -full
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With