diff --git a/api/tacticalrmm/tacticalrmm/utils.py b/api/tacticalrmm/tacticalrmm/utils.py index 5c98df7c..ab1a6d30 100644 --- a/api/tacticalrmm/tacticalrmm/utils.py +++ b/api/tacticalrmm/tacticalrmm/utils.py @@ -339,7 +339,7 @@ def replace_db_values( # check if attr exists and isn't a function if hasattr(obj, temp[1]) and not callable(getattr(obj, temp[1])): temp1 = getattr(obj, temp[1]) - if isinstance(temp1, str) and "'" in temp1: + if shell == ScriptShell.POWERSHELL and isinstance(temp1, str) and "'" in temp1: temp1 = temp1.replace("'", "''") value = f"'{temp1}'" if quotes else temp1 @@ -372,7 +372,11 @@ def replace_db_values( elif value is not None and field.type == CustomFieldType.CHECKBOX: value = format_shell_bool(value, shell) else: - if isinstance(value, str) and "'" in value: + if ( + shell == ScriptShell.POWERSHELL + and isinstance(value, str) + and "'" in value + ): value = value.replace("'", "''") value = f"'{value}'" if quotes else value