fix of powershell adding modules when drive mapping

This commit is contained in:
vfedosevich 2014-06-13 06:32:18 +03:00
parent 9cb2cdd511
commit 916189aa5e

View file

@ -1753,26 +1753,19 @@ namespace WebsitePanel.Providers.HostedSolution
{
HostedSolutionLog.LogStart("OpenRunspace");
bool isModulesImported = true;
if (runspaceConfiguration == null)
{
runspaceConfiguration = RunspaceConfiguration.Create();
isModulesImported = false;
}
Runspace runSpace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
//
runSpace.Open();
//
runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none");
if (!isModulesImported)
{
ImportGroupPolicyMolude(runSpace);
ImportActiveDirectoryMolude(runSpace);
}
ImportGroupPolicyMolude(runSpace);
ImportActiveDirectoryMolude(runSpace);
HostedSolutionLog.LogEnd("OpenRunspace");
return runSpace;
@ -1785,7 +1778,7 @@ namespace WebsitePanel.Providers.HostedSolution
if (runspace != null && runspace.RunspaceStateInfo.State == RunspaceState.Opened)
{
runspace.Close();
//runspaceConfiguration = null;
runspaceConfiguration = null;
}
}
catch (Exception ex)