/// <summary>
/// Helper method to collect the command output as string.
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public string ResultsToString(Collection<PSObject> result)
{
    var resultStr = new StringBuilder();

    foreach (PSObject obj in result)
    {
        resultStr.Append(obj);
    }

    return resultStr.ToString();
}
Categories: c#