Add mailbox via powershell RRS feed

  • Question

  • Hi,


    i've written a gui around powershell to create users and there mailboxes. I first creating the user and after that i make the mailbox. I will run my tool from behind my worstation


    enable-Mailbox -Identity OurDomain\PUK -Database "OurExchangeServer\First Storage Group\Mailbox Database"


    But the command returns a error:

    Enable-Mailbox : The Name property contains leading or trailing whitespace, which must be
    At line:1 char:15
    + enable-Mailbox <<<<  -Identity andreas\PUK -Database "OurExchangeServer\First Storage Group\Mailbo
    x Database"
        + CategoryInfo          : InvalidData: (OurDomain/A...n/Puk P. VanDe :ADObjectId
       ) [Enable-Mailbox], DataValidationException
        + FullyQualifiedErrorId : E7473FB4,Microsoft.Exchange.Management.RecipientTasks.Enab

    What am i doing wrong i dont get it because i've used this command before to create mailboxes without any problem. What ever i try i cant get it to work anymore :(



    Friday, March 18, 2011 3:04 PM


All replies

  • That's by design you need to fix those accounts first, having leading or trailing white space is not rfc compliant.

    How to Remove Spaces From Recipient Aliases by Using the Exchange Management Shell


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
    • Marked as answer by Mike Crowley Tuesday, March 22, 2011 3:50 AM
    Friday, March 18, 2011 3:22 PM
  • Hi,



    You could test to enable a single recipient mailbox without space in  alias first. If you can enable his mailbox with your code, It should be the issue.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Tuesday, March 22, 2011 3:35 AM