DL Error A parameter cannot be found

Glenn Maxwell 12,871 Reputation points
2021-07-05T18:37:47.96+00:00

Hi All

I am executing the below syntaxes to create DL and mail enabled security group, i am getting the below error. if i remove -OnPremisesOrganizationalUnit the syntax works fine. i want to create this in a particular OU. Experts guide me.

New-DistributionGroup -Name "DL1" -Alias "DL1" -DisplayName "DL1" -SamAccountName "DL1" -OnPremisesOrganizationalUnit "OU=MyOU,DC=contoso,DC=com"

New-DistributionGroup -Type Security -Name "MG1" -Alias "MG1" -DisplayName "MG1" -SamAccountName "MG1" -OnPremisesOrganizationalUnit "OU=MyOU,DC=contoso,DC=com"

A parameter cannot be found that matches parameter name 'OnPremisesOrganizationalUnit'.

  • CategoryInfo : InvalidArgument: (:) [New-DistributionGroup], ParameterBindingException
  • FullyQualifiedErrorId : NamedParameterNotFound,New-DistributionGroup
  • PSComputerName : myexchangeserver.contoso.com
Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
Exchange Exchange Server Management
Exchange Hybrid management
0 comments No comments
{count} votes

Accepted answer
  1. Andy David - MVP 157.4K Reputation points MVP Volunteer Moderator
    2021-07-05T19:32:06.643+00:00

    Use
    -OrganizationalUnit

    https://learn.microsoft.com/en-us/powershell/module/exchange/new-distributiongroup?view=exchange-ps

    New-DistributionGroup -Name "DL1" -Alias "DL1" -DisplayName "DL1" -SamAccountName "DL1" -OrganizationalUnit "OU=MyOU,DC=contoso,DC=com"  
    

    "OnPremisesOrganizationalUnit" only applies for remote mailboxes:

    https://learn.microsoft.com/en-us/powershell/module/exchange/new-remotemailbox?view=exchange-ps

    111942-image.png

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.