src/Microsoft.PowerShell.Workflow.ServiceCore/ServiceCore/WorkflowCore/PSRemotingActivitiesBase.cs
/// <summary>
/// Creates Powershell instance and adds the command to it
/// </summary>
/// <param name="context">The activity context to use</param>
/// <param name="connection">The wsman connection to use</param>
/// <param name="commands">The list of commands</param>
Creates Powershell instance and adds the command to it
Creates Powershell instance and adds the command to it
private void CreatePowerShellInstance(NativeActivityContext context, WSManConnectionInfo connection, 
            List<ActivityImplementationContext> commands)
        {
            ActivityImplementationContext implementationContext = GetPowerShell(context);
#if true
            Runspace runspace;
            if (connection != null)
            {
                implementationContext.ConnectionInfo = connection;
                runspace = RunspaceFactory.CreateRunspace(connection);
                implementationContext.PowerShellInstance.Runspace = runspace;
            }
            else
            {
                UpdateImplementationContextForLocalExecution(implementationContext, context);
            }
#endif
            commands.Add(implementationContext);
        }
private void CreatePowerShellInstance ( NativeActivityContext context , WSManConnectionInfo connection , List < ActivityImplementationContext > commands ) { ActivityImplementationContext implementationContext = GetPowerShell ( context ) ; if true Runspace runspace ; if ( connection != null ) { implementationContext . ConnectionInfo = connection ; runspace = RunspaceFactory . CreateRunspace ( connection ) ; implementationContext . PowerShellInstance . Runspace = runspace ; } else { UpdateImplementationContextForLocalExecution ( implementationContext , context ) ; } endif commands . Add ( implementationContext ) ; }
Creates Powershell instance and adds the command to it
Creates Powershell instance and adds the command to it
// Create the PowerShell instance, and add the command to it. // if PSComputerName is "" or $null than connection is NULL // Add it to the queue of commands to execute.
context
NativeActivityContext
The activity context to use
The activity context to use
connection
WSManConnectionInfo
The wsman connection to use
The wsman connection to use
commands
List<ActivityImplementationContext>
The list of commands
The list of commands