Install the AM V2 agent only if AM v2 service is installed # Fix: Remove this check after we move totally to V2 if ((get-service ...

# Install the AM V2 agent only if AM v2 service is installed              # Fix: Remove this check after we move totally to V2              if ((get-service MSExchangeAntimalwareSvc* | where {$_.name -eq "MSExchangeAntimalwareSvc"}))              {                  $agentName = "Malware Agent V2";                  $agentFactory = "Microsoft.Exchange.Transport.Agent.MalwareV2.MalwareAgentFactory";                  $agentAssembly = ($RoleInstallPath + "TransportRoles\agents\AntimalwareV2\Microsoft.Exchange.Transport.Agent.MalwareV2.dll");                  $agent = get-transportagent -Identity:$agentName;                  if ($agent)                   {                  uninstall-transportagent -Identity:$agentName;                  };                  install-TransportAgent -Name:$agentName -TransportAgentFactory:$agentFactory -AssemblyPath:$agentAssembly;                  if (($agent.enabled -or !$agent) -and !$RoleDisableAMFiltering) { enable-transportagent -Identity:$agentName };              }