How do I get the current Cmdlet from another object?

Posted by John Vottero on Stack Overflow See other posts from Stack Overflow or by John Vottero
Published on 2010-05-22T20:47:51Z Indexed on 2010/05/22 20:50 UTC
Read the original article Hit count: 233

Filed under:

What's the best way to get the current PowerShell Cmdlet from another object? If I create a helper object that is not a Cmdlet but will be called by Cmdlets, the helper methods may want to call WriteVerbose, WriteDebug etc. What's the best way to get access to that? Is there a static PowerShell method that will return the current Cmdlet or do I need to have the Cmdlet pass itself to the helper?

© Stack Overflow or respective owner

Related posts about powershell