src/System.Management.Automation/engine/hostifaces/HostUtilities.cs
/// <summary>
/// Create a configured remote runspace from provided name.
/// </summary>
/// <param name="configurationName"></param>
/// <param name="host"></param>
/// <returns></returns>
Create a configured remote runspace from provided name.
Create a configured remote runspace from provided name .
internal static RemoteRunspace CreateConfiguredRunspace(
            string configurationName,
            PSHost host)
        {
            TypeTable typeTable = TypeTable.LoadDefaultTypeFiles();
            var connectInfo = new WSManConnectionInfo();
            connectInfo.ShellUri = configurationName.Trim();
            connectInfo.EnableNetworkAccess = true;
            RemoteRunspace remoteRunspace = null;
            try
            {
                remoteRunspace = (RemoteRunspace)RunspaceFactory.CreateRunspace(connectInfo, host, typeTable);
                remoteRunspace.Open();
            }
            catch (Exception e)
            {
                CommandProcessorBase.CheckForSevereException(e);
                throw new PSInvalidOperationException(
                    StringUtil.Format(RemotingErrorIdStrings.CannotCreateConfiguredRunspace, configurationName),
                    e);
            }
            return remoteRunspace;
        }
internal static RemoteRunspace CreateConfiguredRunspace ( string configurationName , PSHost host ) { TypeTable typeTable = TypeTable . LoadDefaultTypeFiles ( ) ; var connectInfo = new WSManConnectionInfo ( ) ; connectInfo . ShellUri = configurationName . Trim ( ) ; connectInfo . EnableNetworkAccess = true ; RemoteRunspace remoteRunspace = null ; try { remoteRunspace = ( RemoteRunspace ) RunspaceFactory . CreateRunspace ( connectInfo , host , typeTable ) ; remoteRunspace . Open ( ) ; } catch ( Exception e ) { CommandProcessorBase . CheckForSevereException ( e ) ; throw new PSInvalidOperationException ( StringUtil . Format ( RemotingErrorIdStrings . CannotCreateConfiguredRunspace , configurationName ) , e ) ; } return remoteRunspace ; }
Create a configured remote runspace from provided name.
Create a configured remote runspace from provided name .
// Create a loop-back remote runspace with network access enabled, and  // with the provided endpoint configurationname.
None
configurationName
string
None
host
PSHost
None