Forum Discussion
New-AntiPhishPolicy Parameters Don't seem to work properly
I'm making a script to automate the process of setting up EOP automatically for our customers everything works fine, except the part with the anti-phishing policy.
When running the command New-AntiPhishPolicy with a variety of parameters (see Original command) i get the error "-ParameterX" 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 (For full error see Error Example). When the parameters that cause the error are removed from the script i end up with only eight working parameters (See Working parameters). When i create the policy in the GUI all Parameters i use below are available. I also tried different accounts i first tried via delegated acces, i then tried to run the same command with the global admin but no luck either.
Security license used in the tenant:
Defender for O365 (subscription 1)
Original command:
New-AntiPhishPolicy -Name $AntiPhishPolicyName
-ImpersonationProtectionState automatic `
-EnableTargetedUserProtection $true `
-EnableMailboxIntelligenceProtection $true `
-EnableTargetedDomainsProtection $true `
-EnableOrganizationDomainsProtection $true `
-EnableMailboxIntelligence $true `
-EnableFirstContactSafetyTips $true
-EnableSimilarUsersSafetyTips $true `
-EnableSimilarDomainsSafetyTips $true `
-EnableUnusualCharactersSafetyTips $true `
-TargetedUserProtectionAction Quarantine `
-TargetedUserQuarantineTag $quarantinepolicy `
-MailboxIntelligenceProtectionAction Quarantine `
-MailboxIntelligenceQuarantineTag $quarantinepolicy `
-TargetedDomainProtectionAction Quarantine `
-TargetedDomainQuarantineTag $quarantinepolicy `
-AuthenticationFailAction Quarantine `
-SpoofQuarantineTag $quarantinepolicy `
-EnableSpoofIntelligence $true `
-EnableViaTag $true `
-EnableUnauthenticatedSender $true `
-EnableSuspiciousSafetyTip $true `
-PhishThresholdLevel 2 `
-MakeDefault `
-TargetedDomainsToProtect $Customerdomains
Working Parameters:
New-AntiPhishPolicy -Name $AntiPhishPolicyName `
-ImpersonationProtectionState automatic `
-EnableTargetedUserProtection $true `
-EnableMailboxIntelligenceProtection $true `
-EnableTargetedDomainsProtection $true `
-EnableOrganizationDomainsProtection $true `
-EnableMailboxIntelligence $true `
-EnableFirstContactSafetyTips $true
Error Example:
-EnableSimilarUsersSafetyTips : The term '-EnableSimilarUsersSafetyTips' 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 line:9 char:2
+ -EnableSimilarUsersSafetyTips $true `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-EnableSimilarUsersSafetyTips:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-EnableSpoofIntelligence : The term '-EnableSpoofIntelligence' 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 line:20 char:2
+ -EnableSpoofIntelligence $true `
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-EnableSpoofIntelligence:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
1 Reply
- Varun_GhildiyalIron Contributorwell this is strange , did you got any solution.
please raise a case with Microsoft and update the thread if you got any solution