agentName = "Safe Attachment Processing Agent"; $agentFactory = "Microsoft.Exchange.Transport.Agent.SafeAttachmentProces ...

$agentName = "Safe Attachment Processing Agent";                $agentFactory = "Microsoft.Exchange.Transport.Agent.SafeAttachmentProcessing.SafeAttachmentProcessingAgentFactory";                $agentAssembly = ($RoleInstallPath + "TransportRoles\agents\SafeAttachmentProcessingAgent\Microsoft.Exchange.Transport.Agent.SafeAttachmentProcessing.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) { enable-transportagent -Identity:$agentName };