Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Is there any info MamlCommandHelpInfo class

Reply
 
Old 01-09-2008   #1 (permalink)
Bob Landau


 
 

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
Old 01-09-2008   #2 (permalink)
Kirk Munro [MVP]


 
 

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
Quote:

> 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
Old 01-09-2008   #3 (permalink)
Bob Landau


 
 

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:
Quote:

> 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
Quote:

> > 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
Old 01-09-2008   #4 (permalink)
Kirk Munro [MVP]


 
 

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
Quote:

> 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:
>
Quote:

>> 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
Quote:

>> > 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
Reply

Thread Tools


Similar Threads
Thread Forum
When a class is both an inherited class of another, and alsoimplements an interface method .NET General
w= cInt(left(info,inStr(info,"x") -1)) VB Script
win32_pingstatus class / dns class PowerShell
How do I change the administrator info and the registration info?? Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46