Block access to all calendars for a certain group

%3CLINGO-SUB%20id%3D%22lingo-sub-2048958%22%20slang%3D%22en-US%22%3EBlock%20access%20to%20all%20calendars%20for%20a%20certain%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2048958%22%20slang%3D%22en-US%22%3E%3CP%3EHI%20All%20%2C%20really%20hoping%20you%20can%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20looking%20online%20and%20on%20forums%20for%20a%20solution%20but%20cant%20seem%20to%20get%20the%20right%20wording%2C%20as%20im%20sure%20someone%20else%20must%20have%20a%20similar%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20some%20contractors%20in%20our%20365%20organisation%20that%20we%20would%20like%20to%20block%20from%20seeing%20all%20of%20the%20staff's%20calendars.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20default%20we%20have%20set%20that%20all%20calendars%20are%20set%20to%20view%20free%2Fbusy%20and%20some%20users%20have%20changed%20this%20to%20All%20availability%20or%20no%20visibility%20at%20all.%20Ideally%20we%20want%20to%20keep%20this%20under%20their%20control%20and%20for%20them%20to%20manage.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20we%20would%20like%20is%20some%20policy%2F%20script%20that%20blocks%20a%20certain%20security%20group%20from%20viewing%20anyone's%20calendar%20apart%20from%20their%20own.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecan%20anyone%20make%20any%20suggestions%2C%20and%20feel%20free%20to%20ask%20any%20questions%20if%20i'm%20not%20being%20clear!%3A%20%3A)%3C%2Fimg%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESimon%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2049021%22%20slang%3D%22en-US%22%3ERe%3A%20Block%20access%20to%20all%20calendars%20for%20a%20certain%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2049021%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F396591%22%20target%3D%22_blank%22%3E%40simonmccarthy%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPresuming%20you%20have%20all%20your%20contractors%20in%20a%20security%20group%20called%20%3CA%20href%3D%22mailto%3Acontractors%40domain.com%2C%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Econtractors%40domain.com%2C%3C%2FA%3E%26nbsp%3Byou%20can%20execute%20the%20following%20cmdlet%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSPAN%3EAdd-MailboxFolderPermission%20-Identity%20%22User1%40domain.com%3A%5CCalendar%22%20-User%20%22Contractors%40domain.com%22%20-AccessRights%20None%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis'll%20need%20to%20be%20executed%20against%20each%20user%20in%20your%20org.%20(User1%2C%20User2%2C%20User3%2C%20etc.).%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

HI All , really hoping you can help.

 

I have been looking online and on forums for a solution but cant seem to get the right wording, as im sure someone else must have a similar issue.

 

We have some contractors in our 365 organisation that we would like to block from seeing all of the staff's calendars.

 

By default we have set that all calendars are set to view free/busy and some users have changed this to All availability or no visibility at all. Ideally we want to keep this under their control and for them to manage.

 

What we would like is some policy/ script that blocks a certain security group from viewing anyone's calendar apart from their own.

 

can anyone make any suggestions, and feel free to ask any questions if i'm not being clear!: :) 

 

Thanks in advance

 

Simon

3 Replies

Hi @simonmccarthy,

 

Presuming you have all your contractors in a security group called contractors@domain.com, you can execute the following cmdlet:

  • Add-MailboxFolderPermission -Identity "User1@domain.com:\Calendar" -User "Contractors@domain.com" -AccessRights None

 

This'll need to be executed against each user in your org. (User1, User2, User3, etc.). 

@boneyfrancis 

Thanks for this, seems a great place to start!

 

Is there a way of bulk changing this if all of the staff are in a security group also, as this will be over 300 staff to change otherwise :( 

 

Many thanks 

The Identity parameter cannot be a security group, however you can loop in through all users as follows:

1. Create a CSV file with email addresses of all the Users (User1@domain.com, User2@domain.com.. User300@domain.com listed one below the other)
2. Run the cmdlet:
foreach ($user in (import-csv <path to file.csv>)){Add-MailboxFolderPermission -Identity $user:\Calendar -User "Contractors@domain.com" -AccessRights None