(self)
return ps
Creates a nested PowerShell within the current instance. Nested
        PowerShell is used to do simple operations like checking state of a
        variable while another command is using the runspace.

        Nested PowerShell should be invoked from the same thread as the parent
        PowerShell invocation thread. So effectively the parent PowerShell
        invocation thread is blocked until the nested invoke() operation is
        complete.

        :return: The new nested PowerShell object
Creates a nested PowerShell within the current instance. Nested
        PowerShell is used to do simple operations like checking state of a
        variable while another command is using the runspace.
Creates a nested PowerShell within the current instance . Nested PowerShell is used to do simple operations like checking state of a variable while another command is using the runspace .
def create_nested_power_shell(self):
        """
        Creates a nested PowerShell within the current instance. Nested
        PowerShell is used to do simple operations like checking state of a
        variable while another command is using the runspace.

        Nested PowerShell should be invoked from the same thread as the parent
        PowerShell invocation thread. So effectively the parent PowerShell
        invocation thread is blocked until the nested invoke() operation is
        complete.

        :return: The new nested PowerShell object
        """
        if self.state != PSInvocationState.RUNNING:
            raise InvalidPipelineStateError(
                self.state, PSInvocationState.RUNNING,
                "create a nested PowerShell pipeline"
            )
        elif self._from_disconnect:
            raise InvalidPSRPOperation("Cannot created a nested PowerShell "
                                       "pipeline from an existing pipeline "
                                       "that was connected to remotely")

        ps = PowerShell(self.runspace_pool)
        ps.is_nested = True
        return ps
def create_nested_power_shell ( self ) : if self . state != PSInvocationState . RUNNING : raise InvalidPipelineStateError ( self . state , PSInvocationState . RUNNING , "create a nested PowerShell pipeline" ) elif self . _from_disconnect : raise InvalidPSRPOperation ( "Cannot created a nested PowerShell " "pipeline from an existing pipeline " "that was connected to remotely" ) ps = PowerShell ( self . runspace_pool ) ps . is_nested = True return ps