Recursive cmdlets with pipeline support

Welcome Forums General PowerShell Q&A Recursive cmdlets with pipeline support

This topic contains 2 replies, has 2 voices, and was last updated by

 
Inactive
4 years, 2 months ago.

  • Author
    Posts
  • #20540

    Inactive
    Points: 0
    Rank: Member

    I have a cmdlet I have written where I only want the BEGIN and END blocks to be invoked once each, however the PROCESS block is recursive.

    Is their an elegant way to call the PROCESS block instead of the cmdlet itself to accommodate the recursive behavior and skip the BEGIN/END block multiple invocation?

    Thanks!

  • #20541

    Member
    Points: 0
    Rank: Member

    You'd have to make a second, recursive function and call that from the process block, instead of making the advanced function itself recursive.

  • #20545

    Inactive
    Points: 0
    Rank: Member

    Hi,
    That was what I was worried about, it makes more sense to simply move the BEGIN and END blocks out manually versus create a whole new function with only a PROCESS block, that is a shame...

    Thanks

The topic ‘Recursive cmdlets with pipeline support’ is closed to new replies.