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 Tutorial - Support for "heterogeneous path hierarchies" in PS?

Reply
 
Old 04-04-2007   #1 (permalink)
Michael Herman \(Parallelspace/OpenCanal\)
Guest


 
 

Support for "heterogeneous path hierarchies" in PS?

Context

Think of a SharePoint site and the URL that names it. e.g.
http://server/site1/site1_1/site_1_1_1

site_1_1_1 is a SharePoint site that can have 2 kinds of child objects:
subsites and lists/document libraries.

Question

1. If I'm building a custom provider and a path can have 2 types of child
objects, what should get-childitem return?

--
Michael Herman
Parallelspace / OpenCanal
OpenCanal Community for WinFS: http://www.opencanal.com/community/winfs



My System SpecsSystem Spec
Old 04-04-2007   #2 (permalink)
John Vottero
Guest


 
 

Re: Support for "heterogeneous path hierarchies" in PS?

"Michael Herman (Parallelspace/OpenCanal)"
<mwherman@nospam.parallelspace.nospam.net.nospam> wrote in message
news:ukDMCOsdHHA.3272@TK2MSFTNGP03.phx.gbl...
> Context
>
> Think of a SharePoint site and the URL that names it. e.g.
> http://server/site1/site1_1/site_1_1_1
>
> site_1_1_1 is a SharePoint site that can have 2 kinds of child objects:
> subsites and lists/document libraries.
>
> Question
>
> 1. If I'm building a custom provider and a path can have 2 types of child
> objects, what should get-childitem return?


It should return all of the child objects. You can return more than one
type of object. You will probably want to make sure that your
Formats.ps1xml file specifies the same format for all of the objects
returned because out-default only looks at the first object to determine how
to format. If subsequent objects don't use that same format, they are
displayed as a full object dump.

My System SpecsSystem Spec
Old 04-04-2007   #3 (permalink)
Michael Herman \(Parallelspace/OpenCanal\)
Guest


 
 

Re: Support for "heterogeneous path hierarchies" in PS?

Thanks John ...makes sense from a PS philosophy perspective. Also thanks
for the heads-up re: Formats.ps1xml.
--
Michael Herman
Parallelspace / OpenCanal

"John Vottero" <JVottero@mvpsi.com> wrote in message
news:C55022AA-F794-4332-BB21-03186A17796E@microsoft.com...
> "Michael Herman (Parallelspace/OpenCanal)"
> <mwherman@nospam.parallelspace.nospam.net.nospam> wrote in message
> news:ukDMCOsdHHA.3272@TK2MSFTNGP03.phx.gbl...
>> Context
>>
>> Think of a SharePoint site and the URL that names it. e.g.
>> http://server/site1/site1_1/site_1_1_1
>>
>> site_1_1_1 is a SharePoint site that can have 2 kinds of child objects:
>> subsites and lists/document libraries.
>>
>> Question
>>
>> 1. If I'm building a custom provider and a path can have 2 types of child
>> objects, what should get-childitem return?

>
> It should return all of the child objects. You can return more than one
> type of object. You will probably want to make sure that your
> Formats.ps1xml file specifies the same format for all of the objects
> returned because out-default only looks at the first object to determine
> how to format. If subsequent objects don't use that same format, they are
> displayed as a full object dump.
>



My System SpecsSystem Spec
Old 04-05-2007   #4 (permalink)
Michael Herman \(Parallelspace/OpenCanal\)
Guest


 
 

Re: Support for "heterogeneous path hierarchies" in PS?

> It should return all of the child objects. You can return more than one
> type of object.


In a custom cmdlet, how would I receive/process/detect the different types
of objects received via pipeline?

--
Michael Herman
Parallelspace / OpenCanal


"John Vottero" <JVottero@mvpsi.com> wrote in message
news:C55022AA-F794-4332-BB21-03186A17796E@microsoft.com...
> "Michael Herman (Parallelspace/OpenCanal)"
> <mwherman@nospam.parallelspace.nospam.net.nospam> wrote in message
> news:ukDMCOsdHHA.3272@TK2MSFTNGP03.phx.gbl...
>> Context
>>
>> Think of a SharePoint site and the URL that names it. e.g.
>> http://server/site1/site1_1/site_1_1_1
>>
>> site_1_1_1 is a SharePoint site that can have 2 kinds of child objects:
>> subsites and lists/document libraries.
>>
>> Question
>>
>> 1. If I'm building a custom provider and a path can have 2 types of child
>> objects, what should get-childitem return?

>
> It should return all of the child objects. You can return more than one
> type of object. You will probably want to make sure that your
> Formats.ps1xml file specifies the same format for all of the objects
> returned because out-default only looks at the first object to determine
> how to format. If subsequent objects don't use that same format, they are
> displayed as a full object dump.
>



My System SpecsSystem Spec
Old 04-06-2007   #5 (permalink)
John Vottero
Guest


 
 

Re: Support for "heterogeneous path hierarchies" in PS?

"Michael Herman (Parallelspace/OpenCanal)"
<mwherman@nospam.parallelspace.nospam.net.nospam> wrote in message
news:Oct5Iz%23dHHA.4964@TK2MSFTNGP04.phx.gbl...
>> It should return all of the child objects. You can return more than one
>> type of object.

>
> In a custom cmdlet, how would I receive/process/detect the different types
> of objects received via pipeline?
>


You use ParameterSetNames. If your Cmdlet can take a Widget or a Gadget as
parameter 0, you define both parameters, set both to position 0 but give
them different ParameterSetNames. Then, in ProcessRecord you can look at
the value of ParameterSetName to see which object you have.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to restore "RUN" and "Help and Support" commands General Discussion
Problems with the "Require trusted path for credential entry" setting Vista security
"select Name,Path from Win32_Share" permissions required by ASP.NET to return paths, Vista security
Changing default path of "My Documents" (User files)to D: drive? Vista file management
"Open command prompt here" and "Copy as path" Vista performance & maintenance


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