Link to home
Start Free TrialLog in
Avatar of Mr Woober
Mr WooberFlag for Norway

asked on

How to share outlook calendar to users in specific OU

I have an Exchange server 2010 and users running Outlook 2007. And I have 2 different OU, one for administrative users and external users. All users in the administrative OU should be able to see each others calendar, while all external users need to get permission to view calendars. How can I setup this on the Exchange server?

I've been using ExFolders to give permission to everyone, could I just set this permission to be on the administrative OU?
Avatar of phunkodelic
phunkodelic
Flag of United States of America image

I don't believe you can do this though group policy.  Each user will have to do it on there own by doing the following:

1. Login into Outlook 2007
2. Change to folder view.
3. Right click on the calandar and choose "Share Calendar" and follow the prompts.
4. To give the user additionall permssions Right click on calendar again, go to properties, and then  to Permissions Tab and adjust as needed.
No you can not use OU's to set calendar permissions. You would need to script this in powershell is about the only way I can think of.
That does not allow you to share with the OU.  The whole point I would imagine is to make the process automated and simple without the END USER being involved.

10 more mins and I'll have the script for you.
Avatar of Mr Woober

ASKER

Great, thanks alot :)
Phew!

Ok i have used the Quest commandlets on a few lines as i find them easier. But this works fine for me in my lab exchange setup

Do you have a test lab? If not create a test OU with a few users in.

Its not pretty but will do a "Poshed up" version later

You could schedule this to run one a day or however often you like so that if you move some into an OU it updates them
# EE ID: 27373731

#Load Exchange Server 2010 Management Shell if not loaded. You may delete/comment out this step if you are running the script from the Exchange Management Shell
if (-not (Get-PSSnapin | Where-Object {$_.Name -like "Microsoft.Exchange.Management.PowerShell.E2010"})){
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
}
#Load Quest Activeroles Management Shell if not loaded.
if (-not (Get-PSSnapin | Where-Object {$_.Name -like "Quest.Activeroles.admanagement"})){
Add-PSSnapin Quest.Activeroles.admanagement
}

#Variables
$SearchRoot = "OU=ME-Systemtest,OU=STAFF,OU=ERH,DC=MyDomain,DC=COM" # Set to the OU you are running on

$AccessRights = "LimitedDetails" # See http://technet.microsoft.com/en-us/library/ff522363.aspx

$Users = Get-QADUser -SearchRoot $SearchRoot #Get all users in the OU

foreach ($user in $Users )
{
	$mailbox = Get-Mailbox $user.logonname
	$calendar = (($mailbox.SamAccountName)+ ":\" + (Get-MailboxFolderStatistics -Identity $mailbox.SamAccountName -FolderScope Calendar | Select-Object -First 1).Name)
    Set-MailboxFolderPermission -User "Default" -AccessRights "None" -Identity $calendar # Deny deafult user access
	foreach ($otherUser in $Users)
	{
	    if ( $user -ne $otheruser )
		{
			$Error.Clear 
			$ErrorActionPreference = "silentlycontinue"
			Set-MailboxFolderPermission -User "$otherUser" -AccessRights $AccessRights -Identity $calendar
			if (!$?)
				{
				add-MailboxFolderPermission -User "$otherUser" -AccessRights $AccessRights -Identity $calendar
				if (!$?)
					{
					$Error
					}
				$Error.Clear 
				}
		}
	}
}

Open in new window

Ps
ignore all the $error bits, i'll tidy for a published version later.

HTH
ASKER CERTIFIED SOLUTION
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks alot, great work! I will test this today :)
What a great script, thanks alot! Great work mate :)