示例#1
0
 public EmbeddableRunspace(IPSConsole pConsole, string pComputerName, PSCredential pCredential, AuthenticationMechanism pMechanism = AuthenticationMechanism.Credssp)
 {
     embeddedPSHost       = new EmbeddablePSHost(pConsole);
     RemoteConnectionInfo = new WSManConnectionInfo(false, pComputerName, 5985, "/wsman", "http://schemas.microsoft.com/powershell/Microsoft.PowerShell", pCredential);
     //RemoteConnectionInfo.ComputerName = pComputerName;
     //RemoteConnectionInfo.Credential = pCredential;
     RemoteConnectionInfo.AuthenticationMechanism = pMechanism;
     //RemoteConnectionInfo.Port = 5985;
     this.runspace = RunspaceFactory.CreateRunspace(embeddedPSHost, RemoteConnectionInfo);
     this.runspace.Open();
 }
示例#2
0
 public EmbeddableRunspace(IPSConsole pConsole)
 {
     embeddedPSHost = new EmbeddablePSHost(pConsole);
     this.runspace  = RunspaceFactory.CreateRunspace(embeddedPSHost);
     this.runspace.Open();
 }