Powershell Cmdlet used to invoke a Script Block or function in a .ps1 file RRS feed

  • Question

  • Hi,

    Say I have a .ps1 file with some PowerShell script functions in them. I need to invoke a particular function from a C# cmdlet. 

    This link ( ) says how to invoke a script block but it does not provide a complete sample. Its not clear what the parameters are in the call 

    script.Invoke(line, simpleMatch, caseSensitive );

    Is there a complete example available which shows how to call a function in a Powershell script file?

    Is it mandatory to have a script block in such a case or can a function be invoked directly given a file path?



    Wednesday, April 25, 2018 1:54 PM

All replies