How to get error infomation from PowerShell Object in C# programme RRS feed

  • Question

  • After call a powershell command by bellow code:

    Collection<PSObject> results = PowerShell.Invoke();

    I can know whether this command run successfully by PowerShell.Streams.Error.Count.

    if psh.Streams.Error.Count. equal to 0 command  success, otherwise, command failed.

    if command run failed, how to get the error detail ?

    Monday, June 11, 2012 8:10 AM