Intelligent Message Filter, Content Filter, can do more...

WinDeveloper IMF Tune
WinDeveloper IMF Tune

Exchange 2016 CU 7, Install-AntiSpamAgents.ps1 Script Fails

Alexander Zammit

Alexander Zammit Photo

Software Development Consultant. Involved in the development of various Enterprise software solutions. Today focused on Blockchain and DLT technologies.

Cast your Vote
Poor Excellent

The latest Exchange 2016 Cumulative Update (CU7), is causing unnecessary trouble when installing the built-in anti-spam agents. Running Install-AntiSpamAgents.ps1 fails. Here are the details of this problem and how to avoid it.

Cumulative Updates are great when installing a fresh Exchange server. We are able to install the update straight way and we are ready to go with the latest version. Unfortunately if you start off your installation with Exchange 2016 CU7 you might easily run into an annoying problem.

Exchange 2016 CU7 was released last September. The problem is a bit sneaky because it mostly concerns new installations. Indeed I didn't see this myself immediately, not until I had to do a fresh install.

Basically if you try to install the Exchange 2016 anti-spam agents using the script shipped with CU 7 you could run into an error that causes the installation to fail. Here I am referring to the Content Filter, Recipient Filter, Sender Filter, Sender Id Filter and Sender Reputation Filter.

Normally if you don't have the Edge server role, you install these on the Mailbox server as follows:

  1. Open the Exchange Management Shell
  2. Change directory to <Exchange dir.>\Scripts
  3. Run> .\Install-AntiSpamAgents.ps1

Doing this with CU 7 can end-up in failure:

Install-AntiSpamAgents Error

Here is a little text dump of the first part of the error. This should help more people finding this article and the solution presented here.

[PS] E:\ex16\Scripts>.\install-AntispamAgents.ps1
A parameter cannot be found that matches parameter name 'EscalationTeam'.
    + CategoryInfo          : InvalidArgument: (:) [Install-TransportAgent], 
ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Install-TransportAgent
    + PSComputerName        : exchsrv2.adminstop2.com

> : The term '>' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At E:\ex16\Scripts\install-AntispamAgents.ps1:50 char:165
+ ... ransportService $transportService -EscalationTeam "AntiSpam"; > $null
+                                                                   ~
    + CategoryInfo          : ObjectNotFound: (>:String) [], CommandNotFound
Exception
    + FullyQualifiedErrorId : CommandNotFoundException

Transport agent "Content Filter Agent" isn't found.
Parameter name: Identity
    + CategoryInfo          : InvalidArgument: (:) [Enable-TransportAgent], 
ArgumentException
    + FullyQualifiedErrorId : [Server=EXCHSRV2,RequestId=50991627-838d-4fde-
a52d-0bd6c2c389ef,TimeStamp=11/1/2017 9:40:52 AM] [FailureCategory=Cmdlet-Ar
gumentException] 2C3FC7CF,Microsoft.Exchange.Management.AgentTasks.EnableTra
nsportAgent
    + PSComputerName        : exchsrv2.adminstop2.com

 

Solution

This problem is easy to solve especially if you have multiple Exchange installations at hand. Just grab a copy of the install script (Install-AntiSpamAgents.ps1) from an earlier Exchange 2016 update, transfer it to your CU7 installation and use that.

I did that and it worked immediately. I also did take the time to compare the scripts to see exactly what the problem was. Basically this is the culprit:
install-TransportAgent -Name:$name -TransportAgentFactory:$factory -AssemblyPath:$agentAssembly -TransportService $transportService -EscalationTeam "AntiSpam"; $null

The only difference in the CU7 script is this extra bit:
-EscalationTeam "AntiSpam";

Without this bit the script would look exactly like the well behaving scripts we had before.

 

Final Tips

When installing a fresh Exchange server it is always good to start with the latest Cumulative Update. However sometimes we have to deal with these unexpected problems. Hopefully this will be fixed with the next Cumulative Update that is scheduled for next December. In any case I would recommend keeping a copy of the old script handy just in case.

 

References

Released: September 2017 Quarterly Exchange Updates

Cumulative Update 7 for Exchange Server 2016 (KB4018115)

User Comments - Page 1 of 1

WolF 24 Feb 2018 09:41
Thanks very much! I was figting with that very long time and even thining that my server with exchange during installation was corrupted.

BTW on CU8 this issue still wasn't been fixed.
Tam Nguyen 19 Jan 2018 09:46
Thank you so much
Alexander Zammit 12 Jan 2018 05:46
Yes David, apparently it will be fixed in CU9
http://www.exchangeinbox.com/article.aspx?i=218
David Moore 12 Jan 2018 01:17
Looks like it is still a problem in CU8
Toru 30 Nov 2017 22:49
Thank you so much
I Just spent a day and a half trying to get the recipient filtering working in Exch 2016 Cu7 and I finaly found this post and had it working in 2 min. I just edited the script as you showed (removing the red part) and it worked immediately.
one man 22 Nov 2017 10:32
If you ask microsoft regarding this problem, they will answer "this is not a bug, this is a feature" :)
Thankyou 22 Nov 2017 10:29
Thank you for doing the work MS should be doing themselves
Mark Vlad 20 Nov 2017 22:23
Thanks you saved my day
Doron Brenner 9 Nov 2017 14:43
You rock! Why do you know this but not Microsoft?
Copyright © 2005 - 2024 All rights reserved. ExchangeInbox.com is not affiliated with Microsoft Corporation