Help with powershell to grant users rights to their own mailboxes

We're having this strange issue where a few users have lost rights to their own mailboxes.  

We just finished migrating from Exchange 5.5 using Quest's tools and there were some serious issues with the old 5.5 sites and domain.  I'm thinking that the users or rights may never have been created properly.

I'd like to create a script that would reapply full permissions for each user to their mailbox, just to be sure it's been done.  If I still have a problem, then I can further troubleshoot.

I know I can do it via powershell, but don't want to run 1000 lines to get everyone.

Any simple trick out there?
Who is Participating?
BSonPoshConnect With a Mentor Commented:
Hmmm... Lets see. I dont have access to Exchange 2007 environment atm, but perhaps this will work for you

foreach($mailbox in Get-mailbox)
    Add-MailboxPermission $mailbox.Identity -AccessRights FullAccess -user $
odddballAuthor Commented:
Thanks for the info.  That looks pretty good but it's for Exchange 2003.  Not sure it will work for 2007.

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Add-MailboxPermission <mailbox> -AccessRights FullAccess -user <user>

How would you like to provide the user name and mailbox to the script?
odddballAuthor Commented:

Thanks for the response.  How to provide the username and mailbox information to the script is my challenge.

I'm trying to use get-mailbox or get-mailboxpermission and pipe that output to the add-mailboxpermission, but it isn't working.

odddballAuthor Commented:

Thanks so much.  I've not used foreach yet and was having trouble getting it right.
NP... You can do this on one line as well if you perfer

Get-mailbox | %{Add-MailboxPermission $_.Identity -AccessRights FullAccess -user $}
All Courses

From novice to tech pro — start learning today.