Intentando ejecutar el script de powershell en mi código C#. El uso de .NET Framework 4.0.30319 v SP1Rel en VS 2010 en Windows 7."Se produjo un error al cargar los complementos de Windows PowerShell del sistema"
Tengo el siguiente archivo DLL como referencia:.
C: \ Archivos de programa (x86) \ Referencia Asambleas \ Microsoft \ WindowsPowerShell \ v1.0 system.management.automation.dll
\ Y incluyen:
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
Luego, cuando ejecute los siguientes comandos:
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create(); // here
Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
Se estrella en la primera línea con la siguiente excepción:
{"An error occurred when loading the system Windows PowerShell snap-ins. Please contact Microsoft Support Services."}
Excepción interna:
{"Unable to access Windows PowerShell PowerShellEngine registry information."}
soy capaz de correr "Powershell.exe" (versión 2 o 1) en cmd y funciona bien y mi proyecto se compila como debería. Leí esta pregunta (http://social.msdn.microsoft.com/Forums/eu/biztalkesb/thread/a807bee7-531a-4990-b8da-47a7e6e3e099) donde hablaron sobre algunos reg. llaves, pero olvidó mencionar exactamente lo que hizo para arreglarlo. Realmente aprecio cualquier ayuda!
¿funciona si ejecuta la aplicación como administrador local? – Dan
He iniciado sesión como administrador – chikuba
¿Este enlace ayuda? http://stackoverflow.com/questions/2094694/how-can-i-run-powershell-with-the-net-4-runtime – Dan