Я новичок в .net.Проблема с выводом команды powershell в консоль, вызываемую в c #.
Код:
PowerShell powershellCommand = PowerShell.Create();
powershellCommand.AddScript("get-process");
Collection<PSObject> results = powershellCommand.Invoke();
foreach (PSObject result in results)
{
Console.WriteLine(results);
}
Console.Read();
Вывод: System.Collections.ObjectModel.Collection`1 [System.Management.Automation.PSObject]