Como chamar Script ps1 (PowerShell) em c#

0 respostas
rafael2503

Recerbo a mensagem Common Language Runtime detected an invalid program. ao tentar chamar o seguinte script powershell no c# para rodar o script

string text = System.IO.File.ReadAllText(@C:\Users\C5T9\Desktop\AutomatingSoftwareInstallation\CiscoJabberSetup\TeamViewer.ps1);

using (PowerShell PowerShellInstance = PowerShell.Create())

{

PowerShellInstance.AddScript(text);

PowerShellInstance.Invoke();

}
Criado 6 de janeiro de 2020
Respostas 0
Participantes 1