locked
Powershell Script Help - Online Shared Mailbox RRS feed

  • Question

  • Hello,

    Have this script that our SD use to automate mailbox creation in Exchange Online. Works fine on Room Mailboxes but won't work with Shared Mailboxes. Giving the error "A parameter cannot be found that matches parameter Name "Shared""

    But works perfectly fine when I comment out Shared and uncomment Room.. any ideas? Script here:

    $exchangeServer = "exchangeserver.example.com" # TODO: modify me
    $remoteRoutingAddress = "%samaccountname%@domain.mail.onmicrosoft.com" # TODO: modify me
    $mailboxType = "Shared" # TODO: uncomment the type you need
    # $mailboxType = "Room"
    # $mailboxType = "Equipment"
    try
    {
        # Connect to Exchange Server
        $session = New-PSSession -Configurationname Microsoft.Exchange –ConnectionUri http://$exchangeServer/powershell
        Import-PSSession $session -DisableNameChecking -AllowClobber
        # Create remote mailbox
        $parameters = @{
            "Identity" = "%distinguishedName%"
            "RemoteRoutingAddress" = $remoteRoutingAddress
            $mailboxType = $True
        }
        Enable-RemoteMailbox @parameters
    }
    finally
    {
        # Close connection to Exchange Server
        if ($session) { Remove-PSSession $session }
    }

    Could someone take a look and tell me why? I'm totally stumped! Thanks :) 

    • Edited by apb1987 Wednesday, January 23, 2019 3:55 PM Added question
    Wednesday, January 23, 2019 3:54 PM

All replies