We help IT Professionals succeed at work.

Help with powershell to grant users rights to their own mailboxes

odddball
odddball asked
on
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?
Comment
Watch Question

Author

Commented:
Thanks for the info.  That looks pretty good but it's for Exchange 2003.  Not sure it will work for 2007.


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

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

Author

Commented:
BSonPosh,

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.


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 $mailbox.name
}

Author

Commented:
Beautiful!

Thanks so much.  I've not used foreach yet and was having trouble getting it right.

Commented:
NP... You can do this on one line as well if you perfer

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

Explore More ContentExplore courses, solutions, and other research materials related to this topic.