Windows Vista Forums

Is there any info MamlCommandHelpInfo class
  1. #1


    Bob Landau Guest

    Is there any info MamlCommandHelpInfo class

    I'm at the last part of my function which will provide extend functionality
    to what Get-Member does. The only part left is to spit out the man page.



    I had hoped to format it like

    Get-Member -?
    Help Get-Member

    The reason is it word wraps so nicely on the screen. I am also hoping that
    that this will be as easy to duplicate as the formating that Get-Members uses
    (all I needed to do was instanciate a MemberDefinition class which is
    documented) and let the default Powershell formating do its job.

    I was able to "reverse engineer" what Help does by

    (get-process -?) | get-member

    but I'm at a dead end here.

    I suspect others I have done this and can give me some advise. This is
    written as a Powershell function not a Cmdlet but I don't know that makes a
    difference.

    thx
    bob

      My System SpecsSystem Spec

  2. #2


    Kirk Munro [MVP] Guest

    Re: Is there any info MamlCommandHelpInfo class

    Hi Bob,

    MamlCommandHelpInfo is just a custom PSObject with a specific type name
    attached to it. Take a look at the results of the following two commands:

    Get-Help Get-Member | ForEach-Object { $_.GetType() }

    and

    Get-Help Get-Member | ForEach-Object { $_.PSObject.TypeNames }

    The former shows that the base type is PSCustomObject, and the latter shows
    that it is actually derived from another extended object. And both extended
    objects have been assigned custom names.

    Now look at this:

    Get-Help Get-Member | ForEach-Object { $_.PSBase.Members |
    ForEach-Object { $_.Name } }

    and

    Get-Help Get-Member | ForEach-Object { $_.PSObject.Members |
    ForEach-Object { $_.Name } }

    In this case the former shows you the members that were added to the base
    object (which has an extended type name of HelpInfo) and the latter shows
    you those members plus additional members that were added to the derived
    object (which has an extended type name of MamlCommandHelpInfo).

    So while I haven't done this entirely from scratch, I have spent a lot of
    time with the MamlCommandHelpInfo class and I've published a script that
    should be able to help you out here. Take a look at this script:

    http://www.powershellcommunity.org/S...4/Default.aspx

    It contains a Get-Help function that wraps the Get-Help cmdlet so that
    dynamic parameters are properly documented, regardless of which snapin they
    come from. Inside this function there is a
    $createDynamicParameterHelpInfoScriptBlock that shows you how I dynamically
    create part of the help documentation (in this case I'm just adding dynamic
    parameter details) that shows up from the MamlCommandHelpInfo object.

    Functions missing help is something that is lacking in PowerShell 1.0. It
    should be possible to add support for that and have it built directly into
    the Get-Help call by wrapping it similarly to what I have done in my script.

    --
    Kirk Munro [MVP]
    Poshoholic
    http://poshoholic.com


    "Bob Landau" <BobLandau@xxxxxx> wrote in message
    news3CBCE68-F498-409F-BF15-8978D358951F@xxxxxx

    > I'm at the last part of my function which will provide extend
    > functionality
    > to what Get-Member does. The only part left is to spit out the man page.
    >
    > I had hoped to format it like
    >
    > Get-Member -?
    > Help Get-Member
    >
    > The reason is it word wraps so nicely on the screen. I am also hoping that
    > that this will be as easy to duplicate as the formating that Get-Members
    > uses
    > (all I needed to do was instanciate a MemberDefinition class which is
    > documented) and let the default Powershell formating do its job.
    >
    > I was able to "reverse engineer" what Help does by
    >
    > (get-process -?) | get-member
    >
    > but I'm at a dead end here.
    >
    > I suspect others I have done this and can give me some advise. This is
    > written as a Powershell function not a Cmdlet but I don't know that makes
    > a
    > difference.
    >
    > thx
    > bob


      My System SpecsSystem Spec

  3. #3


    Bob Landau Guest

    Re: Is there any info MamlCommandHelpInfo class

    I'll have to look at your script, I'm not directly using the Get-Help
    functionality perhaps thats the way to go.

    In regards to the membes that are added I had saw them but how to use them
    is not obvious. Take a look at the Syntax, Exampes Noteproperty members.

    thx
    bob

    "Kirk Munro [MVP]" wrote:

    > Hi Bob,
    >
    > MamlCommandHelpInfo is just a custom PSObject with a specific type name
    > attached to it. Take a look at the results of the following two commands:
    >
    > Get-Help Get-Member | ForEach-Object { $_.GetType() }
    >
    > and
    >
    > Get-Help Get-Member | ForEach-Object { $_.PSObject.TypeNames }
    >
    > The former shows that the base type is PSCustomObject, and the latter shows
    > that it is actually derived from another extended object. And both extended
    > objects have been assigned custom names.
    >
    > Now look at this:
    >
    > Get-Help Get-Member | ForEach-Object { $_.PSBase.Members |
    > ForEach-Object { $_.Name } }
    >
    > and
    >
    > Get-Help Get-Member | ForEach-Object { $_.PSObject.Members |
    > ForEach-Object { $_.Name } }
    >
    > In this case the former shows you the members that were added to the base
    > object (which has an extended type name of HelpInfo) and the latter shows
    > you those members plus additional members that were added to the derived
    > object (which has an extended type name of MamlCommandHelpInfo).
    >
    > So while I haven't done this entirely from scratch, I have spent a lot of
    > time with the MamlCommandHelpInfo class and I've published a script that
    > should be able to help you out here. Take a look at this script:
    >
    > http://www.powershellcommunity.org/S...4/Default.aspx
    >
    > It contains a Get-Help function that wraps the Get-Help cmdlet so that
    > dynamic parameters are properly documented, regardless of which snapin they
    > come from. Inside this function there is a
    > $createDynamicParameterHelpInfoScriptBlock that shows you how I dynamically
    > create part of the help documentation (in this case I'm just adding dynamic
    > parameter details) that shows up from the MamlCommandHelpInfo object.
    >
    > Functions missing help is something that is lacking in PowerShell 1.0. It
    > should be possible to add support for that and have it built directly into
    > the Get-Help call by wrapping it similarly to what I have done in my script.
    >
    > --
    > Kirk Munro [MVP]
    > Poshoholic
    > http://poshoholic.com
    >
    >
    > "Bob Landau" <BobLandau@xxxxxx> wrote in message
    > news3CBCE68-F498-409F-BF15-8978D358951F@xxxxxx

    > > I'm at the last part of my function which will provide extend
    > > functionality
    > > to what Get-Member does. The only part left is to spit out the man page.
    > >
    > > I had hoped to format it like
    > >
    > > Get-Member -?
    > > Help Get-Member
    > >
    > > The reason is it word wraps so nicely on the screen. I am also hoping that
    > > that this will be as easy to duplicate as the formating that Get-Members
    > > uses
    > > (all I needed to do was instanciate a MemberDefinition class which is
    > > documented) and let the default Powershell formating do its job.
    > >
    > > I was able to "reverse engineer" what Help does by
    > >
    > > (get-process -?) | get-member
    > >
    > > but I'm at a dead end here.
    > >
    > > I suspect others I have done this and can give me some advise. This is
    > > written as a Powershell function not a Cmdlet but I don't know that makes
    > > a
    > > difference.
    > >
    > > thx
    > > bob
    >
    >
    >

      My System SpecsSystem Spec

  4. #4


    Kirk Munro [MVP] Guest

    Re: Is there any info MamlCommandHelpInfo class

    I totally agree. Creating the Syntax structure took a lot of
    troubleshooting on my part. You can see script that specifically does this
    in the script block I mentioned below that is part of the
    CmdletExtensionLibrary.ps1 script file.

    --
    Kirk Munro [MVP]
    Poshoholic
    http://poshoholic.com


    "Bob Landau" <BobLandau@xxxxxx> wrote in message
    news:61BF1EB7-C6A7-4352-8BC5-51A18D3A0964@xxxxxx

    > I'll have to look at your script, I'm not directly using the Get-Help
    > functionality perhaps thats the way to go.
    >
    > In regards to the membes that are added I had saw them but how to use them
    > is not obvious. Take a look at the Syntax, Exampes Noteproperty members.
    >
    > thx
    > bob
    >
    > "Kirk Munro [MVP]" wrote:
    >

    >> Hi Bob,
    >>
    >> MamlCommandHelpInfo is just a custom PSObject with a specific type name
    >> attached to it. Take a look at the results of the following two
    >> commands:
    >>
    >> Get-Help Get-Member | ForEach-Object { $_.GetType() }
    >>
    >> and
    >>
    >> Get-Help Get-Member | ForEach-Object { $_.PSObject.TypeNames }
    >>
    >> The former shows that the base type is PSCustomObject, and the latter
    >> shows
    >> that it is actually derived from another extended object. And both
    >> extended
    >> objects have been assigned custom names.
    >>
    >> Now look at this:
    >>
    >> Get-Help Get-Member | ForEach-Object { $_.PSBase.Members |
    >> ForEach-Object { $_.Name } }
    >>
    >> and
    >>
    >> Get-Help Get-Member | ForEach-Object { $_.PSObject.Members |
    >> ForEach-Object { $_.Name } }
    >>
    >> In this case the former shows you the members that were added to the base
    >> object (which has an extended type name of HelpInfo) and the latter shows
    >> you those members plus additional members that were added to the derived
    >> object (which has an extended type name of MamlCommandHelpInfo).
    >>
    >> So while I haven't done this entirely from scratch, I have spent a lot of
    >> time with the MamlCommandHelpInfo class and I've published a script that
    >> should be able to help you out here. Take a look at this script:
    >>
    >> http://www.powershellcommunity.org/S...4/Default.aspx
    >>
    >> It contains a Get-Help function that wraps the Get-Help cmdlet so that
    >> dynamic parameters are properly documented, regardless of which snapin
    >> they
    >> come from. Inside this function there is a
    >> $createDynamicParameterHelpInfoScriptBlock that shows you how I
    >> dynamically
    >> create part of the help documentation (in this case I'm just adding
    >> dynamic
    >> parameter details) that shows up from the MamlCommandHelpInfo object.
    >>
    >> Functions missing help is something that is lacking in PowerShell 1.0.
    >> It
    >> should be possible to add support for that and have it built directly
    >> into
    >> the Get-Help call by wrapping it similarly to what I have done in my
    >> script.
    >>
    >> --
    >> Kirk Munro [MVP]
    >> Poshoholic
    >> http://poshoholic.com
    >>
    >>
    >> "Bob Landau" <BobLandau@xxxxxx> wrote in message
    >> news3CBCE68-F498-409F-BF15-8978D358951F@xxxxxx

    >> > I'm at the last part of my function which will provide extend
    >> > functionality
    >> > to what Get-Member does. The only part left is to spit out the man
    >> > page.
    >> >
    >> > I had hoped to format it like
    >> >
    >> > Get-Member -?
    >> > Help Get-Member
    >> >
    >> > The reason is it word wraps so nicely on the screen. I am also hoping
    >> > that
    >> > that this will be as easy to duplicate as the formating that
    >> > Get-Members
    >> > uses
    >> > (all I needed to do was instanciate a MemberDefinition class which is
    >> > documented) and let the default Powershell formating do its job.
    >> >
    >> > I was able to "reverse engineer" what Help does by
    >> >
    >> > (get-process -?) | get-member
    >> >
    >> > but I'm at a dead end here.
    >> >
    >> > I suspect others I have done this and can give me some advise. This is
    >> > written as a Powershell function not a Cmdlet but I don't know that
    >> > makes
    >> > a
    >> > difference.
    >> >
    >> > thx
    >> > bob
    >>
    >>
    >>


      My System SpecsSystem Spec

Is there any info MamlCommandHelpInfo class problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving from class C to class B ip address scheme, any tips(DC/DNS) markm75g Server General 1 14 Feb 2010
When a class is both an inherited class of another, and alsoimplements an interface method Curious .NET General 1 14 Aug 2009
w= cInt(left(info,inStr(info,"x") -1)) Benny Pedersen VB Script 6 25 Feb 2009
win32_pingstatus class / dns class IT Staff PowerShell 2 28 Oct 2008
How do I change the administrator info and the registration info?? Heather Vista account administration 3 31 May 2007