none
Exchange Management Shell - New mailbox room fail RRS feed

  • Question

  • I folks! I'm trying to create new mailboxes (room) in Exchange Management Shell with this script, but I get the error message: New-Mailbox : Cannot bind parameter 'Name' to the target. Exception setting "Name": "The Name property contains leading or trailing whitespace, which must be removed."
    I have tried with "$RumNamn" and '$RumNamn' in the last line but It doesn't work.
    The mailbox names look like: Room 10 - left-side (20 pers)
    Any ideas?

    param(
        [Parameter(Mandatory = $true)]
        [string] $RumNamn,
        [Parameter(Mandatory = $true)]
        [string] $RumAlias
        )
    #--this line works--:
        Write-host $RumNamn $RumAlias
    #--this line doesn't--:
    New-Mailbox -Name $RumNamn -Database "EX005\SG04\4MB01"  -OrganizationalUnit "MyDomain.net/Resurses/myrum" -UserPrincipalName $RumAlias@MyDomain.net -Room
    Thursday, September 10, 2015 2:39 PM

Answers

  • Hi,

    When creating new mailbox, do not enter leading or trailing whitespace after -Name parameter.

      Right

    Wrong

    Wrong

    Best Regards.


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Lynn-Li
    TechNet Community Support

    Friday, September 11, 2015 2:42 AM
    Moderator
  • Hi Lyn-Li  and thanks a lot for your answer.

    The problem was that I copied and pasted  the name of the rooms from Excel. I suppose I got a space in the beginning of the text then. I tried to type the name manually and it worked perfect.

    \Emilio

    Friday, September 11, 2015 7:45 AM

All replies

  • Hi,

    When creating new mailbox, do not enter leading or trailing whitespace after -Name parameter.

      Right

    Wrong

    Wrong

    Best Regards.


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Lynn-Li
    TechNet Community Support

    Friday, September 11, 2015 2:42 AM
    Moderator
  • Hi Lyn-Li  and thanks a lot for your answer.

    The problem was that I copied and pasted  the name of the rooms from Excel. I suppose I got a space in the beginning of the text then. I tried to type the name manually and it worked perfect.

    \Emilio

    Friday, September 11, 2015 7:45 AM