(self, script, use_local_scope=None)
return self
Add a piece of script to construct a command pipeline.

        :param script: A string representing a script
        :param use_local_scope: Run the script under the local scope
        :return: the current PowerShell instance with the command added
Add a piece of script to construct a command pipeline.
Add a piece of script to construct a command pipeline .
def add_script(self, script, use_local_scope=None):
        """
        Add a piece of script to construct a command pipeline.

        :param script: A string representing a script
        :param use_local_scope: Run the script under the local scope
        :return: the current PowerShell instance with the command added
        """
        command = Command(protocol_version=self.runspace_pool.protocol_version,
                          cmd=script, is_script=True,
                          use_local_scope=use_local_scope)
        self.commands.append(command)
        self._current_command = command
        return self
def add_script ( self , script , use_local_scope = None ) : command = Command ( protocol_version = self . runspace_pool . protocol_version , cmd = script , is_script = True , use_local_scope = use_local_scope ) self . commands . append ( command ) self . _current_command = command return self