none
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 ( https://msdn.microsoft.com/en-us/library/ms714819(v=vs.85).aspx ) 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?

    TIA,

    Jy

    Wednesday, April 25, 2018 1:54 PM

All replies