public ImportPSModule ( string name ) : void | ||
name | string | |
Résultat | void |
public AppFabricPowershellCommandRunner() { _state = InitialSessionState.CreateDefault(); _state.ImportPSModule(new string[] { "DistributedCacheAdministration", "DistributedCacheConfiguration" }); _state.ThrowOnRunspaceOpenError = true; _runspace = RunspaceFactory.CreateRunspace(_state); _runspace.Open(); }
public PowershellEnvironment(params PowershellModule[] modules) { initialSessionState = InitialSessionState.CreateDefault(); string[] moduleFullPath=new string[modules.Length]; for(int i=0;i<modules.Length;i++) { moduleFullPath[i] = modules[i].FullPath; initialSessionState.Assemblies.Add(new SessionStateAssemblyEntry(modules[i].FullPath)); } initialSessionState.ImportPSModule(moduleFullPath); runspace = RunspaceFactory.CreateRunspace(initialSessionState); }
protected void OpenRunspace() { HostedSolutionLog.LogStart("OpenRunspace"); if (session == null) { session = InitialSessionState.CreateDefault(); session.ImportPSModule(new[] {"Hyper-V"}); } Runspace runSpace = RunspaceFactory.CreateRunspace(session); runSpace.Open(); runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); RunSpace = runSpace; HostedSolutionLog.LogEnd("OpenRunspace"); }
protected virtual Runspace OpenRunspace() { Log.WriteStart("OpenRunspace"); if (session == null) { session = InitialSessionState.CreateDefault(); session.ImportPSModule(new string[] { "FileServerResourceManager" }); } Runspace runSpace = RunspaceFactory.CreateRunspace(session); // runSpace.Open(); // runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); Log.WriteEnd("OpenRunspace"); return runSpace; }
internal virtual Runspace OpenRunspace() { HostedSolutionLog.LogStart("OpenRunspace"); if (session == null) { session = InitialSessionState.CreateDefault(); session.ImportPSModule(new string[] { "ActiveDirectory", "Lync", "LyncOnline" }); } Runspace runSpace = RunspaceFactory.CreateRunspace(session); // runSpace.Open(); // runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); HostedSolutionLog.LogEnd("OpenRunspace"); return runSpace; }
/// <summary> /// Initializes a new instance of the <see cref="PsInterface"/> class. /// </summary> public PsInterface() { this._iss = InitialSessionState.CreateDefault(); _iss.ImportPSModule(new string[] { "Hyper-V" }); }