{"id":390772,"date":"2025-07-21T18:39:37","date_gmt":"2025-07-21T18:39:37","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=390772"},"modified":"2025-07-22T08:21:10","modified_gmt":"2025-07-22T08:21:10","slug":"it-leitfaden-anpassen-von-antivirus-overrides-mit-einem-bash-skript-in-linux","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/it-leitfaden-anpassen-von-antivirus-overrides-mit-einem-bash-skript-in-linux\/","title":{"rendered":"IT-Leitfaden: Anpassen von Antivirus-Overrides mit einem Bash-Skript in Linux              \u00a0"},"content":{"rendered":"<h2>Vorwort<\/h2>\n<p>Die genaue Pflege der Antivirus-Statusinformationen auf Ger\u00e4ten ist f\u00fcr IT-Profis und <a href=\"https:\/\/www.ninjaone.com\/de\/was-ist-ein-msp\/\">Managed Service Providers (MSPs)<\/a>.entscheidend. Die Verfolgung von Antiviren-Versionen, -Status und -Updates stellt sicher, dass Sicherheitsrichtlinien durchgesetzt werden und Systeme gesch\u00fctzt bleiben. In Linux-Umgebungen kann dieser Prozess durch Automatisierung vereinfacht werden. In diesem Beitrag wird ein Bash-Skript untersucht, das f\u00fcr die Verwaltung von Antiviren-\u00dcberschreibungen auf Ger\u00e4ten entwickelt wurde und IT-Teams ein praktisches Tool f\u00fcr die Verwaltung ihrer Endpunkt-Sicherheitsinformationen bietet.<\/p>\n<h2>Kontext<\/h2>\n<p>In IT-Umgebungen, insbesondere bei MSPs, die verschiedene Ger\u00e4teflotten verwalten, ist der Virenschutzstatus eine wichtige Kennzahl. Allerdings kommt es h\u00e4ufig zu Diskrepanzen zwischen dem tats\u00e4chlichen Zustand der Antivirensoftware auf einem Ger\u00e4t und der Darstellung in den \u00dcberwachungstools. Mit diesem Skript k\u00f6nnen IT-Experten Antiviren-Informationen manuell einstellen oder aktualisieren, einschlie\u00dflich Name, Version, Status und Update-Status. Durch die M\u00f6glichkeit der Anpassung oder Entfernung von \u00dcberschreibungen wird die Verwaltung der Endpunktsicherheit in Umgebungen, die auf Tools wie NinjaOne angewiesen sind, optimiert.<\/p>\n<h2>Das Skript zur Optimierung der Hintergrund-Verwaltung<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/usr\/bin\/env bash\r\n#\r\n# Description: Add an antivirus to the device details or override the existing antivirus information.\r\n# By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n# Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n# Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n# Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n# Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n# Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n# Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n# EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#\r\n# Preset Parameter: --antivirusName \"ReplaceMeWithYourDesiredName\"\r\n#   Name of the antivirus you would like to appear in the device details.\r\n#\r\n# Preset Parameter: --antivirusVersion \"1.0.2\"\r\n#   Specify the version number of the antivirus.\r\n#\r\n# Preset Parameter: --antivirusStatus \"Up-to-Date\"\r\n#   Specify whether the antivirus definitions are Up-to-Date, Out-of-Date, or Unknown.\r\n#\r\n# Preset Parameter: --antivirusState \"ON\"\r\n#   Specify the current status of the antivirus.\r\n#\r\n# Preset Parameter: --removeOverride\r\n#   Remove all existing overrides.\r\n#\r\n# Preset Parameter: --antivirusState\r\n#   Append or update an existing override.\r\n#\r\n# Preset Parameter: --help\r\n#\t\tDisplays a help menu.\r\n#\r\n# Release Notes: Initial Release\r\n\r\n# Initialize variables\r\n_arg_antivirusName=\r\n_arg_antivirusVersion=\r\n_arg_antivirusStatus=\r\n_arg_antivirusState=\r\n_arg_removeOverride=\"off\"\r\n_arg_append=\"off\"\r\n\r\n# Function to display help message\r\nprint_help() {\r\n  printf '\\n\\n%s\\n\\n' 'Usage: [--antivirusName|-n &lt;arg&gt;] [--antivirusVersion|-v &lt;arg&gt;] [--antivirusStatus|--status &lt;arg&gt;] [--antivirusState|--state &lt;arg&gt;] [--removeOverride|-r] [--append|-a] [--help|-h] '\r\n  printf '%s\\n' 'Preset Parameter: --antivirusName \"ReplaceMeWithYourDesiredName\"'\r\n  printf '\\t%s\\n' \"Name of the antivirus you would like to appear in the device details.\"\r\n  printf '%s\\n' 'Preset Parameter: --antivirusVersion \"1.0.2\"'\r\n  printf '\\t%s\\n' \"Specify the version number of the antivirus.\"\r\n  printf '%s\\n' 'Preset Parameter: --antivirusStatus \"Up-to-Date\"'\r\n  printf '\\t%s\\n' \"Specify whether the antivirus definitions are Up-to-Date, Out-of-Date, or Unknown.\"\r\n  printf '%s\\n' 'Preset Parameter: --antivirusState \"ON\"'\r\n  printf '\\t%s\\n' \"Specify the current status of the antivirus.\"\r\n  printf '%s\\n' 'Preset Parameter: --removeOverride'\r\n  printf '\\t%s\\n' \"Remove all existing overrides.\"\r\n  printf '%s\\n' 'Preset Parameter: --antivirusState'\r\n  printf '\\t%s\\n' \"Append or update an existing override.\"\r\n  printf '\\n%s\\n' 'Preset Parameter: --help'\r\n  printf '\\t%s\\n' \"Displays this help menu.\"\r\n}\r\n\r\n# Function to print an error message and exit\r\ndie() {\r\n  local _ret=\"${2:-1}\"\r\n  echo \"$1\" &gt;&amp;2\r\n  test \"${_PRINT_HELP:-no}\" = yes &amp;&amp; print_help &gt;&amp;2\r\n  exit \"${_ret}\"\r\n}\r\n\r\n# Function to parse command line arguments\r\nparse_commandline() {\r\n  while test $# -gt 0; do\r\n    _key=\"$1\"\r\n    case \"$_key\" in\r\n    --antivirusName | --antivirusname | --name | -n)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the argument '$_key'.\" 1\r\n      _arg_antivirusName=$2\r\n      shift\r\n      ;;\r\n    --antivirusName=*)\r\n      _arg_antivirusName=\"${_key##--antivirusName=}\"\r\n      ;;\r\n    --antivirusVersion | --antivirusversion | --version | -v)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the argument '$_key'.\" 1\r\n      _arg_antivirusVersion=$2\r\n      shift\r\n      ;;\r\n    --antivirusVersion=*)\r\n      _arg_antivirusVersion=\"${_key##--antivirusVersion=}\"\r\n      ;;\r\n    --antivirusStatus | --antivirusstatus | --status)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the argument '$_key'.\" 1\r\n      _arg_antivirusStatus=$2\r\n      shift\r\n      ;;\r\n    --antivirusStatus=*)\r\n      _arg_antivirusStatus=\"${_key##--antivirusStatus=}\"\r\n      ;;\r\n    --antivirusState | --antivirusstate | --state)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the argument '$_key'.\" 1\r\n      _arg_antivirusState=$2\r\n      shift\r\n      ;;\r\n    --antivirusState=*)\r\n      _arg_antivirusState=\"${_key##--antivirusState=}\"\r\n      ;;\r\n    --removeOverride | --remove | -r)\r\n      _arg_removeOverride=\"on\"\r\n      ;;\r\n    --append | --Append | -a)\r\n      _arg_append=\"on\"\r\n      ;;\r\n    --help | -h)\r\n      _PRINT_HELP=yes die 0\r\n      ;;\r\n    *)\r\n      _PRINT_HELP=yes die \"[Error] Got an unexpected argument '$1'\" 1\r\n      ;;\r\n    esac\r\n    shift\r\n  done\r\n}\r\n\r\n# Parse the command line arguments\r\nparse_commandline \"$@\"\r\n\r\n# Replace commandline parameters with script form variables\r\nif [[ -n $avName ]]; then\r\n  _arg_antivirusName=\"$avName\"\r\nfi\r\nif [[ -n $avVersion ]]; then\r\n  _arg_antivirusVersion=\"$avVersion\"\r\nfi\r\nif [[ -n $avStatus ]]; then\r\n  _arg_antivirusStatus=\"$avStatus\"\r\nfi\r\nif [[ -n $avState ]]; then\r\n  _arg_antivirusState=\"$avState\"\r\nfi\r\nif [[ -n $append &amp;&amp; $append == \"true\" ]]; then\r\n  _arg_append=\"on\"\r\nfi\r\nif [[ -n $removeOverride &amp;&amp; $removeOverride == \"true\" ]]; then\r\n  _arg_removeOverride=\"on\"\r\nfi\r\n\r\n# Ensure that removing an override and adding\/updating an override are not done simultaneously\r\nif [[ $_arg_removeOverride == \"on\" &amp;&amp; (-n $_arg_antivirusName || -n $_arg_antivirusState || -n $_arg_antivirusStatus || -n $_arg_antivirusVersion || $_arg_append == \"on\") ]]; then\r\n  _PRINT_HELP=no die \"[Error] Cannot remove an override and add an override at the same time.\" 1\r\nfi\r\n\r\n# Check for required antivirus name and escape special characters if necessary\r\nreservedCharacters='[\\\"]'\r\nif [[ -z $_arg_antivirusName &amp;&amp; $_arg_removeOverride != \"on\" ]]; then\r\n  if [[ $_arg_append == \"on\" ]]; then\r\n    _PRINT_HELP=yes die \"[Error] Antivirus name was not given. The antivirus name is required when updating or adding a new override!\" 1\r\n  else\r\n    _PRINT_HELP=yes die \"[Error] Antivirus name was not given. Antivirus name, state, and status are required when adding a new override!\" 1\r\n  fi\r\nelif [[ -n $_arg_antivirusName &amp;&amp; $_arg_antivirusName =~ $reservedCharacters ]]; then\r\n  _arg_antivirusName=${_arg_antivirusName\/\/\\\\\/\\\\\\\\}\r\n  _arg_antivirusName=${_arg_antivirusName\/\/\\\"\/\\\\\\\"}\r\nfi\r\n\r\n# Check for required antivirus status\r\nif [[ -z $_arg_antivirusStatus &amp;&amp; $_arg_removeOverride != \"on\" &amp;&amp; $_arg_append != \"on\" ]]; then\r\n  _PRINT_HELP=yes die \"[Error] Antivirus status was not given. Antivirus name, state, and status are required!\" 1\r\nfi\r\n\r\n# Validate antivirus status\r\nif [[ -n $_arg_antivirusStatus &amp;&amp; $_arg_antivirusStatus != \"Up-to-Date\" &amp;&amp; $_arg_antivirusStatus != \"Out-of-Date\" &amp;&amp; $_arg_antivirusStatus != \"Unknown\" ]]; then\r\n  _PRINT_HELP=no die \"[Error] An invalid antivirus status of '$_arg_antivirusStatus' was given. Only the following statuses are valid. 'Up-to-Date', 'Out-of-Date', and 'Unknown'.\" 1\r\nfi\r\n\r\n# Check for required antivirus state\r\nif [[ -z $_arg_antivirusState &amp;&amp; $_arg_removeOverride != \"on\" &amp;&amp; $_arg_append != \"on\" ]]; then\r\n  _PRINT_HELP=yes die \"[Error] Antivirus state was not given. Antivirus name, state, and status are required!\" 1\r\nelse\r\n  _arg_antivirusState=$(echo \"$_arg_antivirusState\" | tr '[:lower:]' '[:upper:]')\r\nfi\r\n\r\n# Validate antivirus state\r\nif [[ -n $_arg_antivirusState &amp;&amp; $_arg_antivirusState != \"ON\" &amp;&amp; $_arg_antivirusState != \"OFF\" &amp;&amp; $_arg_antivirusState != \"EXPIRED\" &amp;&amp; $_arg_antivirusState != \"SNOOZED\" &amp;&amp; $_arg_antivirusState != \"UNKNOWN\" ]]; then\r\n  _PRINT_HELP=no die \"[Error] An invalid antivirus state of '$_arg_antivirusState' was given. Only the following states are valid. 'ON', 'OFF', 'EXPIRED', 'SNOOZED', and 'UNKNOWN'.\" 1\r\nfi\r\n\r\n# Validate antivirus version\r\nif [[ -n $_arg_antivirusVersion &amp;&amp; $_arg_antivirusVersion =~ [^0-9\\.] ]]; then\r\n  _PRINT_HELP=no die \"[Error] The antivirus version given '$_arg_antivirusVersion' contains an invalid character. Only the following characters are allowed. '0-9' and '.'\" 1\r\nfi\r\n\r\n# Check if the removeOverride flag is set to \"on\"\r\nif [[ $_arg_removeOverride == \"on\" ]]; then\r\n  echo \"Removing override as requested.\"\r\n  # Check if the override file exists\r\n  if [[ ! -f \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" ]]; then\r\n    echo \"No override present.\"\r\n    exit 0\r\n  # Try to remove the override file and capture any error output\r\n  elif output=$(rm \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" 2&gt;&amp;1); then\r\n    echo \"Succesfully removed override!\"\r\n    exit 0\r\n  # Print an error message if the removal fails\r\n  else\r\n    echo \"[Error] Failed to remove override!\"\r\n    echo \"[Error] $output\"\r\n  fi\r\nfi\r\n\r\n# Check if the customization directory exists\r\nif [[ ! -d \"\/opt\/NinjaRMMAgent\/programdata\/customization\" ]]; then\r\n  echo \"Creating customization folder at '\/opt\/NinjaRMMAgent\/programdata\/customization'.\"\r\n  # Try to create the customization directory and capture any error output\r\n  if output=$(mkdir \"\/opt\/NinjaRMMAgent\/programdata\/customization\" 2&gt;&amp;1); then\r\n    echo \"Folder created.\"\r\n  else\r\n    # Print an error message if the creation fails\r\n    echo \"[Error] Unable to create customization folder.\" &gt;&amp;2\r\n    echo \"[Error] $output\" &gt;&amp;2\r\n    exit 1\r\n  fi\r\nfi\r\n\r\n# Check if the append flag is set to \"on\" and the override JSON file exists\r\nif [[ $_arg_append == \"on\" &amp;&amp; -f \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" ]]; then\r\n  # Extract antivirus names, versions, statuses and states from the JSON file\r\n  avNames=$(grep \"av_name\" \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" | tr -s \" \" | sed s\/\\\"av_name\\\":\/\/g | sed -e 's\/^[[:space:]]*\/\/' | sed 's\/[\\\",]\/\/g' | sed -e 's\/[[:space:]]*$\/\/')\r\n  avVersions=$(grep \"av_version\" \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" | tr -s \" \" | sed s\/\\\"av_version\\\":\/\/g | sed -e 's\/^[[:space:]]*\/\/' | sed 's\/[\\\",]\/\/g' | sed -e 's\/[[:space:]]*$\/\/')\r\n  avStatuses=$(grep \"av_status\" \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" | tr -s \" \" | sed s\/\\\"av_status\\\":\/\/g | sed -e 's\/^[[:space:]]*\/\/' | sed 's\/[\\\",]\/\/g' | sed -e 's\/[[:space:]]*$\/\/')\r\n  avStates=$(grep \"av_state\" \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\" | tr -s \" \" | sed s\/\\\"av_state\\\":\/\/g | sed -e 's\/^[[:space:]]*\/\/' | sed 's\/[\\\",]\/\/g' | sed -e 's\/[[:space:]]*$\/\/')\r\n\r\n  # Find the line number of the existing antivirus entry with the given name\r\n  existingAV=$(echo \"$avNames\" | grep -n \"$_arg_antivirusName\" | sed 's\/:.*\/\/g')\r\n\r\n  # Determine the desired antivirus status\r\n  if [[ -n $_arg_antivirusStatus ]]; then\r\n    desiredStatus=$_arg_antivirusStatus\r\n  elif [[ -n $existingAV ]]; then\r\n    desiredStatus=$(echo \"$avStatuses\" | sed -n \"${existingAV}p\")\r\n  fi\r\n\r\n  # Determine the desired antivirus state\r\n  if [[ -n $_arg_antivirusState ]]; then\r\n    desiredState=$_arg_antivirusState\r\n  elif [[ -n $existingAV ]]; then\r\n    desiredState=$(echo \"$avStates\" | sed -n \"${existingAV}p\")\r\n  fi\r\n\r\n  # Check if both status and state are provided\r\n  if [[ -z $desiredStatus || -z $desiredState ]]; then\r\n    _PRINT_HELP=no die \"[Error] Antivirus state or status are missing from the override entry. Please provide both in addition to the antivirus name!\" 1\r\n  fi\r\n\r\n  # Update the existing antivirus entry if found\r\n  if [[ -n $existingAV ]]; then\r\n    echo \"Attempting to update override.\"\r\n\r\n    # Update antivirus version if provided\r\n    if [[ -n $_arg_antivirusVersion ]]; then\r\n      modified_json=$(awk -v target=\"$existingAV\" -v value=\"$_arg_antivirusVersion\" 'BEGIN { av_count = 1 }\r\n      \/av_version\/ { \r\n        if (av_count == target){ \r\n          sub( \/av_version.*\/ , \"av_version\\\":  \\\"\"value\"\\\",\" ) \r\n        }\r\n        av_count++\r\n      }{ print }' \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\")\r\n\r\n      if echo \"$modified_json\" &gt;\"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\"; then\r\n        echo \"Successfully updated the antivirus version!\"\r\n      else\r\n        echo \"[Error] Failed to update the antivirus version!\" &gt;&amp;2\r\n        exit 1\r\n      fi\r\n    fi\r\n\r\n    # Update antivirus status if provided\r\n    if [[ -n $_arg_antivirusStatus ]]; then\r\n      modified_json=$(awk -v target=\"$existingAV\" -v value=\"$_arg_antivirusStatus\" 'BEGIN { av_count = 1 }\r\n      \/av_status\/ { \r\n        if (av_count == target){ \r\n          sub( \/av_status.*\/ , \"av_status\\\":  \\\"\"value\"\\\",\" ) \r\n        }\r\n        av_count++\r\n      }{print}' \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\")\r\n\r\n      if echo \"$modified_json\" &gt;\"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\"; then\r\n        echo \"Successfully updated the override status!\"\r\n      else\r\n        echo \"[Error] Failed to update the override status!\" &gt;&amp;2\r\n        exit 1\r\n      fi\r\n    fi\r\n\r\n    # Update antivirus state if provided\r\n    if [[ -n $_arg_antivirusState ]]; then\r\n      modified_json=$(awk -v target=\"$existingAV\" -v value=\"$_arg_antivirusState\" 'BEGIN { av_count = 1 }\r\n      \/av_state\/ { \r\n        if (av_count == target){ \r\n          sub( \/av_state.*\/ , \"av_state\\\":  \\\"\"value\"\\\"\" ) \r\n        }\r\n        av_count++\r\n      }{print}' \"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\")\r\n\r\n      if echo \"$modified_json\" &gt;\"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\"; then\r\n        echo \"Successfully updated the override state!\"\r\n      else\r\n        echo \"[Error] Failed to update the override state!\" &gt;&amp;2\r\n        exit 1\r\n      fi\r\n    fi\r\n\r\n    exit\r\n  fi\r\n\r\n  # Print a message indicating that the script is attempting to append an override\r\n  echo \"Attempting to append override.\"\r\n  # Initialize a counter for indexing\r\n  i=1\r\n  # Initialize the JSON structure for antivirus overrides\r\n  avOverrides=\"{\r\n  \\\"av_override\\\": [\r\n\"\r\n  # Loop through each antivirus name\r\n  for avName in $avNames; do\r\n    # Extract the corresponding antivirus version, status and state for the current index\r\n    avVersion=$(echo \"$avVersions\" | sed -n \"${i}p\")\r\n    avStatus=$(echo \"$avStatuses\" | sed -n \"${i}p\")\r\n    avState=$(echo \"$avStates\" | sed -n \"${i}p\")\r\n\r\n    # Append the current antivirus entry to the JSON structure\r\n    avOverrides+=\"    {\r\n      \\\"av_name\\\":  \\\"${avName}\\\",\r\n      \\\"av_version\\\": \\\"${avVersion}\\\",\r\n      \\\"av_status\\\":  \\\"${avStatus}\\\",\r\n      \\\"av_state\\\": \\\"${avState}\\\"\r\n    },\r\n\"\r\n    # Increment the counter for the next iteration\r\n    i=$((i + 1))\r\n  done\r\n\r\n  # Close the JSON structure\r\n  avOverrides+=\"    {\r\n      \\\"av_name\\\":  \\\"${_arg_antivirusName}\\\",\r\n      \\\"av_version\\\": \\\"${_arg_antivirusVersion}\\\",\r\n      \\\"av_status\\\":  \\\"${_arg_antivirusStatus}\\\",\r\n      \\\"av_state\\\": \\\"${_arg_antivirusState}\\\"\r\n    }\r\n  ]\r\n}\r\n\"\r\n\r\n  # Attempt to write the JSON structure containing antivirus overrides to the specified file\r\n  if echo \"$avOverrides\" &gt;\"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\"; then\r\n    echo \"Succesfully added override.\"\r\n    exit\r\n  else\r\n    echo \"[Error] Failed to add override.\" &gt;&amp;2\r\n    exit 1\r\n  fi\r\nfi\r\n\r\n# Check if the antivirus state or status arguments are missing\r\nif [[ -z $_arg_antivirusState || -z $_arg_antivirusStatus ]]; then\r\n  _PRINT_HELP=no die \"[Error] Antivirus name, state and status are required when adding a new override!\" 1\r\nfi\r\n\r\n# Construct the JSON string for the antivirus override\r\nJSON_STRING=\"{\r\n  \\\"av_override\\\": [\r\n    {\r\n      \\\"av_name\\\":  \\\"${_arg_antivirusName}\\\",\r\n      \\\"av_version\\\":  \\\"${_arg_antivirusVersion}\\\",\r\n      \\\"av_status\\\":  \\\"${_arg_antivirusStatus}\\\",\r\n      \\\"av_state\\\":  \\\"${_arg_antivirusState}\\\"\r\n    }\r\n  ]\r\n}\r\n\"\r\n\r\n# Attempt to write the JSON string to the specified file\r\nif echo \"$JSON_STRING\" &gt;\"\/opt\/NinjaRMMAgent\/programdata\/customization\/av_override.json\"; then\r\n  # If the write operation is successful, print a success message\r\n  echo \"Succesfully created override.\"\r\nelse\r\n  # If the write operation fails, print an error message to standard error\r\n  echo \"[Error] Failed to create override.\" &gt;&amp;2\r\n  exit 1\r\nfi\r\n<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Sparen Sie Zeit mit \u00fcber 300+ Skripten aus dem NinjaOne Dojo.<\/p>\n<p>\u2192 <a class=\"waffle-rich-text-link\" href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Zugang heute erhalten<\/a>.<\/p>\n<\/div>\n<h2>Detailansicht<\/h2>\n<p>Dieses Skript automatisiert das Hinzuf\u00fcgen oder Aktualisieren von Antivirus-\u00dcberschreibungen in einer JSON-basierten Konfigurationsdatei. So funktioniert es Schritt f\u00fcr Schritt:<\/p>\n<p><strong>1. Parameter initialisieren<\/strong><\/p>\n<p>a. Das Skript beginnt mit der Definition von Variablen f\u00fcr Name, Version, Status und Zustand des Antivirus. Flaggen wie &#8211;remove Override und &#8211;append werden ebenfalls initialisiert, um bestimmte Aktionen zu behandeln.<\/p>\n<p><strong>2. Befehlszeilen-Parse<\/strong><\/p>\n<p>a. Die Funktion `parse_commandline` verarbeitet die Argumente, die beim Ausf\u00fchren des Skripts bereitgestellt werden. Zum Beispiel legt `&#8211;antivirusName &#8222;MyAntivirus&#8220;` den Namen des Antivirenprogramms fest.<\/p>\n<p><strong>3. Validierung<\/strong><\/p>\n<p>a. Das Skript stellt sicher, dass obligatorische Parameter angegeben werden, wenn sie ben\u00f6tigt werden. Es \u00fcberpr\u00fcft die g\u00fcltigen Status (Aktuell, Nicht Aktuell oder Unbekannt) und Zust\u00e4nde (EIN, AUS, ABGELAUFEN, PAUSIERT oder UNBEKANNT).<\/p>\n<p><strong>4. Entfernen von \u00dcberschreibungen<\/strong><\/p>\n<p>a. Wenn das Flag &#8211;removeOverride gesetzt ist, l\u00f6scht das Skript die bestehende \u00dcberschreibungs-JSON-Datei. Wenn keine solche Datei existiert, wird das Skript sauber beendet.<\/p>\n<p><strong>5. Hinzuf\u00fcgen oder Aktualisieren von \u00dcberschreibungen<\/strong><\/p>\n<p>a. Wenn die &#8211;append-Option verwendet wird, \u00fcberpr\u00fcft das Skript, ob bereits Eintr\u00e4ge in der JSON-Datei vorhanden sind. Es aktualisiert entweder die Details eines bestehenden Antivirus-Eintrags oder f\u00fcgt einen neuen hinzu.<\/p>\n<p><strong>6. Schreiben von \u00dcberschreibungen<\/strong><\/p>\n<p>a. Wenn das Flag &#8211;append nicht gesetzt ist, schreibt das Skript eine neue JSON-Struktur mit den angegebenen Antiviren-Details. Diese Struktur wird an einem bestimmten Ort gespeichert.<\/p>\n<h2>Potenzielle Anwendungsf\u00e4lle<\/h2>\n<h3>Szenario: Ein MSP, der Client-Ger\u00e4te verwaltet<\/h3>\n<p>Stellen Sie sich vor, ein MSP \u00fcberwacht Ger\u00e4te f\u00fcr mehrere Kunden. Ein neues Antiviren-Update verursacht Verz\u00f6gerungen bei der Statussynchronisierung mit dem \u00dcberwachungstool. Durch die Bereitstellung dieses Skripts auf den betroffenen Ger\u00e4ten kann der MSP den Status vor\u00fcbergehend au\u00dfer Kraft setzen und das Antivirusprogramm als &#8222;Up-to-Date&#8220; und &#8222;ON&#8220; markieren, um sicherzustellen, dass die Compliance-Berichte korrekt bleiben, bis das Problem behoben ist.<\/p>\n<h2>Vergleiche<\/h2>\n<p>Andere Methoden zur Verwaltung des Antiviren-Status umfassen die manuelle Bearbeitung von JSON-Dateien oder die Verwendung integrierter Tools in Remote Monitoring and Management (RMM)-Plattformen. Im Vergleich zu manuellen Bearbeitungen reduziert dieses Skript menschliche Fehler und beschleunigt den Prozess. Im Gegensatz zu plattformspezifischen Tools bietet es Flexibilit\u00e4t f\u00fcr Linux-Umgebungen, in denen solche Integrationen m\u00f6glicherweise nicht vorhanden sind.<\/p>\n<h2>FAQs<\/h2>\n<ul>\n<li><strong>Kann dieses Skript mit allen Antivirenprogrammen funktionieren?<\/strong><br \/>\nEs interagiert nicht direkt mit der Antivirensoftware, sondern \u00e4ndert die JSON-Datei, die \u00dcberschreibungen enth\u00e4lt, und ist somit unabh\u00e4ngig von bestimmten Antivirenl\u00f6sungen.<\/li>\n<li><strong>Was passiert, wenn ich es ohne die erforderlichen Argumente ausf\u00fchre?<\/strong><br \/>\nDas Skript enth\u00e4lt detaillierte Fehlermeldungen und Verwendungshinweise, um die korrekte Ausf\u00fchrung zu unterst\u00fctzen.<\/li>\n<li><strong>Wie kann ich \u00c4nderungen, die durch dieses Skript vorgenommen wurden, r\u00fcckg\u00e4ngig machen?<\/strong><br \/>\nVerwenden Sie das Flag &#8211;removeOverride, um die Override-Konfigurationsdatei zu l\u00f6schen.<\/li>\n<li><strong>Kann ich dieses Skript auch auf Nicht-Linux-Systemen verwenden?<\/strong><br \/>\nEs ist f\u00fcr Linux-Umgebungen konzipiert, da es auf Bash und Linux-Dateipfade angewiesen ist.<\/li>\n<\/ul>\n<h2>Folgen<\/h2>\n<p>Die effektive Verwendung dieses Skripts gew\u00e4hrleistet eine genaue Darstellung des Antiviren-Status auf allen Ger\u00e4ten. Auf diese Weise werden falsch positive oder negative Ergebnisse bei der Sicherheits\u00fcberwachung reduziert und die Cybersicherheit im Unternehmen erh\u00f6ht. Eine unsachgem\u00e4\u00dfe Verwendung oder ung\u00fcltige \u00dcberschreibungen k\u00f6nnen jedoch zu Unstimmigkeiten f\u00fchren, was die Notwendigkeit einer sorgf\u00e4ltigen Verwaltung unterstreicht.<\/p>\n<h2>Empfehlungen<\/h2>\n<ul>\n<li>Testen Sie das Skript immer auf einem nicht produktiven Ger\u00e4t, um sein Verhalten zu \u00fcberpr\u00fcfen.<\/li>\n<li>Verwenden Sie klare und einheitliche Namenskonventionen f\u00fcr Antivirenl\u00f6sungen, um Konflikte zu vermeiden.<\/li>\n<li>Dokumentieren Sie die auf die Ger\u00e4te angewendeten \u00dcberschreibungen zur sp\u00e4teren Verwendung.<\/li>\n<li>Beschr\u00e4nken Sie den Zugriff auf dieses Skript, um unbefugte \u00c4nderungen zu verhindern.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Dieses Skript ist ein Beispiel daf\u00fcr, wie die Automatisierung die <a href=\"https:\/\/www.ninjaone.com\/de\/effizienz\/\">Effizienz<\/a> und Genauigkeit der IT-Verwaltung verbessert. F\u00fcr Benutzer von NinjaOne oder \u00e4hnlichen RMM-Plattformen ist der Einsatz von Tools wie diesem Skript zusammen mit fortschrittlichen Endpunktverwaltungsfunktionen ein Garant f\u00fcr eine stabile Sicherheitslage. NinjaOne vereinfacht die Sichtbarkeit und das Management von Endpunkten und bietet eine einheitliche Plattform, um IT-Abl\u00e4ufe zu optimieren und Herausforderungen wie Virenschutz\u00fcberschreibungen pr\u00e4zise zu bew\u00e4ltigen.<\/p>\n","protected":false},"author":35,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4211],"use_cases":[4306],"class_list":["post-390772","script_hub","type-script_hub","status-publish","hentry","script_hub_category-linux"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/390772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/comments?post=390772"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=390772"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=390772"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=390772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}