• Running Exchange 2007 command for multiple mailboxes

    Home » Forums » Admin IT Lounge » Application servers – Exchange, IIS, Sharepoint » Running Exchange 2007 command for multiple mailboxes

    Author
    Topic
    #497480

    My company recently had an issue with our old AD/Exchange 2003 server and had to restore from a backup which turned out to be quite a project. We also run Exchange 2007 on another server and had about half the company moved to the new server when this happened. We restored the old server and moved all the mailboxes to the new server leaving AD on the old server. Now when people try to access their mailbox using OWA they get an error that the mailbox is not accessable. The solution is to run the following commands from the command line for each mailbox.

    Get-Mailbox | format-list ExchangeVersion

    Set-Mailbox -ApplyMandatoryProperties

    Since we’re dealing with 159 mailboxes is there any way to make this do all of them at once?

    Any help would be appreciated.

    Viewing 2 reply threads
    Author
    Replies
    • #1477038

      The first command only checks what version they are using. I assume you want to use the output of that to determine which ones need to be moved (have policy applied)? Something like this in Powershell should work.
      Note: I haven’t used the correct version name because I don’t have a box to test. Can you provide the output of a get-mailbox command so we can check?
      Note 2: You probably need to test if the user is a real user as well, not an alias or public address.

      cheers, Paul

      $Exusers = get-mailbox *
      foreach ($user in $Exusers) {
      if ($user.ExchangeVersion = 2003) {Set-Mailbox $user -ApplyMandatoryProperties}
      }

      • #1478143

        Thank you so much Paul. Your script worked like a champ. We were even able to modify it to assign mailbox rights en-mass to all the mailboxes. You’ve always been a great help to me and I appreciate it more than you know.

    • #1478360

      Glad to be of service. 🙂

      cheers, Paul

    • #1478546

      @rmallen07 – I strongly recommend you pick up a book on PowerShell, or better yet, take class (online classes are good for PowerShell). It will elevate your understanding of what is happening when you run any Exchange commands, and help you to build more complex commands to work on multiple mailboxes. If your organization is growing, or if you take greater advantage of Exchange features, this new skill will come into play quite often.

      A nice added benefit is that PowerShell can be used for Active Directory administration, Windows server and workstation administration, SQL administration….the list goes on. The basic concepts are shared across each type of administration, with specific commands used for specific administrative tasks.

    Viewing 2 reply threads
    Reply To: Running Exchange 2007 command for multiple mailboxes

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: