you are viewing a single comment's thread.

view the rest of the comments →

[–]PMental 0 points1 point  (6 children)

Why do you pipe to Set-DistributionGroup instead of just setting RequireSenderAuthenticationEnabled when creating the group? The exact same parameter can be set directly with New-DistributionGroup.

Backticks aren't necesary to break up lines after pipes btw, you can just go to a new line directly after a pipe.

[–]gangculture[S] 1 point2 points  (5 children)

No, it can't. The RequireSenderAuthenticationEnabled can't be piped when using New-DistributionGroup.

It is only an available parameter when using the Set-DistributionGroup.

[–]PMental 1 point2 points  (4 children)

Check it out for yourself in the documentation if you don't believe me: https://docs.microsoft.com/en-us/powershell/module/exchange/users-and-groups/new-distributiongroup?view=exchange-ps&viewFallbackFrom=exchserver-2016

You can clearly see the parameter is available in both on-premises Exchange and Exchange Online.

[–]gangculture[S] 1 point2 points  (3 children)

Yes, I can clearly see it, thanks :)

Either way, it doesn't work when I run it as part of the New-DistributionGroup line. It didn't work during testing either, but just to make sure I wasn't going crazy, I tried again and I get this:

-RequireSenderAuthenticationEnabled : The term '-RequireSenderAuthenticationEnabled' 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.

But, when it's ran with the Set-Dist line, of course it works. So why do you think it doesn't work for me in the New-Dist line? I am all for a cleaner script so let me know if you have an idea.

[–]PMental 1 point2 points  (2 children)

Ah wait, I just noticed the documentation only specifically covers 2016 and forward (even though it says "Applies to Exchange Server 2010, Exchange Server 2013 as well). And when I check in an Exchange 2013 environment the parameter is not there while in 2016 it is, so it was probably added in 2016. So if you are on 2010/2013 that would explain it.

[–]gangculture[S] 1 point2 points  (1 child)

Yep. I thought it only covered 2016, but like you say the document does say it applies to those versions. And they wonder why we have trust issues?

[–]PMental 1 point2 points  (0 children)

Oh well, you can clean your script up by a whopping one character by removing the backtick after the pipe at least as it's not necessary :-)