0

I'm trying to add file types to Exchange Server 2019 malware policy. For that purpose, I follow Microsoft documentation shown at https://learn.microsoft.com/en-us/powershell/module/exchange/antispam-antimalware/set-malwarefilterpolicy?view=exchange-ps

Example 2 is exactly what I need:

$FileTypesAdd = Get-MalwareFilterPolicy -Identity Default | select -Expand FileTypes; $FileTypesAdd += "com","bat"; Set-MalwareFilterPolicy -Identity Default -EnableFileFilter $true -FileTypes $FileTypesAdd

Unfortunately, when I execute that example inside Exchange Management Shell, I get the following error message:

A parameter cannot be found that matches parameter name 'EnableFileFilter'. + CategoryInfo : InvalidArgument: (:) [Set-MalwareFilterPolicy], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Set-MalwareFilterPolicy + PSComputerName : exchange.bndt.local

I run Exchange Server 2016 (CU14) on a local Windows Server 2016 (Fully up-to-date). I don't clearly understand what is wrong.

Any help appreciated.

Regards

fpiette
  • 11,983
  • 1
  • 24
  • 46
  • Back in the days, Exchange cmdlets required colons to [pass switch parameter values](https://stackoverflow.com/q/8525572/503046); maybe this is such a case too? Try adding a colon to the parameter `-EnableFileFilter:$true` – vonPryz Dec 11 '19 at 08:12
  • Adding a colon results in the very same error. – fpiette Dec 11 '19 at 10:57
  • The erreor "NamedParameterNotFound" makes me thinking that there is a typo in the cmdlet. Is the source available somewhere? – fpiette Dec 11 '19 at 11:01
  • Maybe [a hack](https://blogs.msdn.microsoft.com/luisdem/2016/05/19/get-the-source-code-of-the-powershell-cmdlets/) via `Get-Command` and ILSpy would be of use. – vonPryz Dec 11 '19 at 11:12
  • Altough it works as expected for Get-date, the hack you mention doesn't display anything for Set-MalwareFilterPolicy. – fpiette Dec 11 '19 at 11:41
  • Maybe -EnableFileFilter requires a special permission? I'm logged with permission groups domain admin, enterprise admin, schema admin and origanization management. – fpiette Dec 11 '19 at 11:49

0 Answers0