help does not work in the function

I have created a function with the [cmdletbinding()] attribute, however when I run

help <name of the function> it does not return the help on the function. However the function works fine when I run it with the specified parameters.

and when I use help <name of the function> it is listed twice in the drop down menu. Any suggestions on this?

Hmmm … please be honest: Do you really think you provided enough information for us to be able to help you? :wink: :smiley: Please provide more detailed information.

Write it like this and show us

 

[pre]

<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
function Verb-Noun
{
[CmdletBinding()]
[Alias()]
[OutputType([int])]
Param
(

Param1 help description

[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
$Param1,

Param2 help description

[int]
$Param2
)

Begin
{
}
Process
{
}
End
{
}
}

[/pre]

Hmmm … I recommend to read The PowerShell Best Practices and Style Guide - especially the chapter about Code Layout & Formatting and there particularily the paragraph about Indentation! :wink: :smiley:

[quote quote=167929]Hmmm … I recommend to read The PowerShell Best Practices and Style Guide – especially the chapter about Code Layout & Formatting and there particularily the paragraph about Indentation! :wink: :grinning:

[/quote]
thats the site :slight_smile:

my editor works like a charm :slight_smile:

 

I fixed one part of the issue. I deleted the Module folder and recreated it. It is under Documents\WindowsPowerShell\Modules\Get-Test\Get-Test.psm1

Now if I type help Get-Test, it shows the help. However still when I run help Get-T I see all the functions which start with Get-T and I see two listing for Get-Test, the first command works fine. However when I select the second Get-Test in the list, it types the below in the console.

help Get-Test\Get-Test

and when I run it, it returns an error saying Get-help: Get-help could not find Get-Test\Get-Test in a help file in this session.

Are you still using the PowerShell console session you opened before. Try opening a new console.

OK, so how do you think others do it here in this forum? :wink: … I’ll show you what I mean:

<#
.SYNOPSIS
A brief description of the function.

    .DESCRIPTION
        A detailed description of the function.

    .PARAMETER  ParameterA
        The description of the ParameterA parameter.

    .PARAMETER  ParameterB
        The description of the ParameterB parameter.

    .EXAMPLE
        PS C:\&gt; Get-Something -ParameterA 'One value' -ParameterB 32

    .EXAMPLE
        PS C:\&gt; Get-Something 'One value' 32

    .INPUTS
        System.String,System.Int32

    .OUTPUTS
        System.String

    .NOTES
        Additional information about the function go here.

    .LINK
        about_functions_advanced

    .LINK
        about_comment_based_help

#&gt;

function Test-AdvancedFunction {
[CmdletBinding()]
[OutputType([System.Int32])]
param(
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$Name,

    [Parameter(Position = 1)]
    [ValidateNotNull()]
    [System.Int32]
    $Index
)
Begin {
    try {
    
    }
    catch {
        throw
    }
}
Process {
    try {
    
    }
    catch {
        throw
    }
}
End {
    try {
    }
    catch {
        throw
    }
}

}


I’d say: No, it’s not the site. :wink: :smiley: