我有一个在c#中运行powershell命令的应用程序。我希望我的运行空间在运行我的应用程序时不加载用户的配置文件。这是我的代码初始化运行空间:
var iss = InitialSessionState.CreateDefault();
iss.AuthorizationManager = new AuthorizationManager(Guid.NewGuid().ToString());
var host = new CustomHost(Append);
_runspace = RunspaceFactory.CreateRunspace(host, iss);
_runspace.ThreadOptions = PSThreadOptions.UseCurrentThread;
_runspace.ApartmentState = ApartmentState.STA;
_runspace.Open();
Runspace.DefaultRunspace = _runspace;
有什么想法吗?