How to give every exchange user permissions to view every other exchange user’s calendar.

I was after a way to centrally manage shared calendars so that everyone in the company could view every single other user’s calendar. I found a few scripts on the internet but none did exactly what I wanted – many failed right off the bat when trying to assign permissions to “DOMAIN\Domain Users” or similar.

I eventually found one and modified it for my use. This powershell script can be pasted in then press enter a few times and it will run against every user on the system assigning read permissions for every user.

$userAccounts = get-mailbox -resultsize unlimited
ForEach ($user in $userAccounts)
{
	$userAccountssec = get-mailbox -resultsize unlimited
	$myUser = $user
	ForEach ($user in $userAccountssec)
	{
	 Add-MailboxFolderPermission -Identity ($myUser.UserPrincipalName + ":\Calendar") -User $user.UserPrincipalName -AccessRights Reviewer
	}
}

Because my wordpress layout chops off the right hand side, click and drag over the entire script to highlight it and then copy it to clipboard. Then paste it into notepad or similar so you can see the entire add-mailboxfolderpermission line.

You could probably also use the above script as a template for any other command you would like to run for every user against every user.

This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to How to give every exchange user permissions to view every other exchange user’s calendar.

  1. Lloyd says:

    Great, thanks mate! I was looking for this script everywhere. I tried this a few different ways but the loops weren’t correct. It takes a while to run though, and we don’t even have many O365 accounts. Does this need to be run every time a new account is added? And does it just fill in the blanks or is it overwriting every permission (will just take longer and longer)?

  2. You would need to run this each time a new account is added. When running it again you will get an error about permissions already existing and it will just move onto the next (and probably error again etc.).. I think when it errors it is quicker than when it has to apply a permissions update. I don’t recall it being too tedious to re-run.

  3. Lloyd says:

    Ahhh, of course, because the command is “Add permission” not “Set permission” :)
    I am really enjoying PowerShell since starting with it yesterday!
    One last question, since you seem to be a wizard with this stuff… why do I need an explicit permission for each user, why isn’t “Default = Reviewer” enough?
    Cheers

  4. Reviewer: Might be.. I’ve never tried that option. Not sure why.

    Powershell is fantastic but has so many options and “nesting” and looping queries isn’t always clear or easy.
    I’ve got quite a few example scripts that I’ve posted – mainly for my own reference in the future but you might find some of them or some of the code within them to be interesting:
    https://thecomputerperson.wordpress.com/?s=powershell

Comment on this topic

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s