def _winrm_run_cmd(self, session, command, args=(), env=None, cwd=None):
        """Run a command on the remote host and return the standard output and
        error as a tuple.

        Extended from pywinrm to support passing env and cwd to open_shell,
        as well as enforcing the UTF-8 codepage. Also supports timeouts.

        """
        shell_id = session.protocol.open_shell(
            working_directory=cwd,
            env_vars=env,
            codepage=65001,
        )
        command_id = session.protocol.run_command(shell_id, command, args)
        # try/catch is for custom timeout handing (StackStorm custom)
        try:
            rs = Response(
                self._winrm_get_command_output(session.protocol, shell_id, command_id)
            )
            rs.timeout = False
        except WinRmRunnerTimoutError as e:
            rs = e.response
            rs.timeout = True
        # end stackstorm custom
        session.protocol.cleanup_command(shell_id, command_id)
        session.protocol.close_shell(shell_id)
        return rs
Run a command on the remote host and return the standard output and
        error as a tuple.

        Extended from pywinrm to support passing env and cwd to open_shell,
        as well as enforcing the UTF-8 codepage. Also supports timeouts.

        
contrib/runners/winrm_runner/winrm_runner/winrm_base.py