1

I've created a small script to test creating my own help based powershell and i received error:

Get-Help : Cannot find Help for topic ".\testHelp.ps1". At line:49 char:15 + Get-Help <<<< @PSBoundParameters | more + CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Heres the test script:

<#
SYNOPSIS
retrieive a list of services from local and remote machines 
.DESCRIPTION
Retrieive services from local and remote machines and reports the following fields
.PARAMETER  Servers 
The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer.
.EXAMPLE
PS C:\> Get-Something 'One value' 32
#>
param($computername="localhost")
Get-WmiObject -Class Win32_BIOS -ComputerName $computername

2 Answers 2

4

Looks like you're missing the . in front of .SYNOPSIS. Also your help says the parameter is called Servers but the param block says $computername. PowerShell is pretty finicky about the help formatting being just right although I don't think it validates parameter names. :-)

The result is:

PS> Get-Content .\FuncHelp.ps1
<#
.SYNOPSIS
retrieive a list of services from local and remote machines 
.DESCRIPTION
Retrieive services from local and remote machines and reports the following fields
.PARAMETER  Servers 
The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer.
.EXAMPLE
PS C:\> Get-Something 'One value' 32
#>
param($computername="localhost")
Get-WmiObject -Class Win32_BIOS -ComputerName $computername


PS> .\FuncHelp.ps1 -?

NAME
    C:\Users\hillr\FuncHelp.ps1

SYNOPSIS
    retrieive a list of services from local and remote machines


SYNTAX
    C:\Users\hillr\FuncHelp.ps1 [[-computername] <Object>] [<CommonParameters>]


DESCRIPTION
    Retrieive services from local and remote machines and reports the following fields


RELATED LINKS

REMARKS
    To see the examples, type: "get-help C:\Users\hillr\FuncHelp.ps1 -examples".
    For more information, type: "get-help C:\Users\hillr\FuncHelp.ps1 -detailed".
    For technical information, type: "get-help C:\Users\hillr\FuncHelp.ps1 -full".
Sign up to request clarification or add additional context in comments.

3 Comments

Ive put a . in front and still same issue
Is Get-Help being proxied? Try running to Get-Command Get-Help | Format-List * to see which module Get-Help is coming from.
the powershell script was also running through a UNC path which the security didnt like. Copied locally and problem solved.
0

You can use free Quest editor called PowerGui. You've got the a snippet (CTRL+I) for functions with advanced help. It gives you all the advanced help keywords as you can find in about_Comment_Based_Help

You can put <# #> befor your function or inside, but be careful with special characters inside the help it cause me some errors when copy/pasting some examples from the net or PDF documents.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.