diff --git a/contents/winrm_session.py b/contents/winrm_session.py index 0ea4402..1fa187f 100644 --- a/contents/winrm_session.py +++ b/contents/winrm_session.py @@ -29,7 +29,7 @@ PY3 = sys.version_info[0] == 3 PY34 = sys.version_info[0:2] >= (3, 4) RD = "RD_" -RD_COMMAND = "RD_EXEC_COMMAND" +INVALID_CHAR = "%" if PY3: string_types = str, @@ -55,7 +55,7 @@ def run_cmd(self, command, args=(), out_stream=None, err_stream=None): envs = {} for a in os.environ: - if a.startswith(RD) and a != RD_COMMAND: + if a.startswith(RD) and INVALID_CHAR not in os.environ[a]: envs.update({a:os.getenv(a)}) # TODO optimize perf. Do not call open/close shell every time