PowerShell Script from TechDays Office365 Demo


 

Today I have had the privilege of doing both a BreakOut Session on Secure Remote Access in Lync, and a Demo Session on Office365, together with my colleague Koen Van Tolhuyzen, at the TechDays in Antwerp!

In this demo session, we tried to show off the wonderful world of Office365, in the limited time of 35minutes…which was actually too short, but I’m happy we have been able to show some of the nice features included, as the just-released New Time Management Application, for which you can find more information here: http://www.microsoft.com/presspass/features/2011/apr11/04-27CalendarAnalytics.mspx

As promised, here’s the PowerShell script I used to demonstrate Exchange Management Shell, against our O365 tenant. And as said, you can use this one as well against your Exchange On Premise Organization Smile

Question/Challenge: is it possible to grant everyone Reviewer permission to everyone’s calendar in your Exchange Organization?

Answer: sure, by using a simple Shell script Smile

Step 1. Definition of the problem

When I try to open up the calendar of one of my colleagues, by default I can only see whether he/she is busy or not, as shown in the print screen below:

IVC-0672

Step 2. Resolve the problem

The problem is that by default, the default user has got the permission of “AvailabilityOnly” on the calendar…in order to see full details, I could change the value to Reviewer, as an example. Let’s see…

To see the permissions for the calendar, I can use the cmdlet Get-MailboxFolderPermission, so to retrieve the permission set on the calendar of the mailbox belonging to Ilse, I can enter: Get-MailboxFolderPermission ilse:\calendar.

IVC-0673

To change the permission of the Default user to Reviewer, I can run the cmdlet Set-MailboxFolderPermission ilse:\calendar –User default –AccessRights Reviewer:

IVC-0674

Step 3. Another Issue Pops Up

Now I would like to change the permission on the calendar of Koen, but when running the cmdlet Get-MailboxFolderPermission koen:\calendar, I end up with the following error:

IVC-0675

Reason is that Koen doesn’t have a Calendar, but an “Agenda”:

IVC-0676

So, in order to change the permissions on the calendar, we need to get a hold of the folder names… we can use the cmdlet Get-MailboxFolderStatistics Smile

Step 4. Retrieve the Folder Namings

In order to retrieve the folder names for all mailboxes in your organization, we can use the following Shell line:
Get-Mailbox | Get-MailboxFolderStatistics | Where {$_.Foldertype -ilike "calendar"} | ft identity,name,folderpath

IVC-0677

When you export this output to an excel file, you can use it as input to change the permissions for everyone to Reviewer on everyone’s calendar Smile

Get-Mailbox | Get-MailboxFolderStatistics | Where {$_.Foldertype -ilike "calendar"} | select identity | export-csv names.csv

IVC-0678

Step 5. Another issue pops up

In order to change the permissions, you need to define the name of the folder as “userid”:\”foldername”, but when looking at the content of the names.csv file, it only shows “userid”\”foldername”. In order to change the \ to :\, you could use notepad, and do a find replace (as I did in the demo session), but off course you could use the shell for this Smile

IVC-0679

Running the following line, will get the content op names.csv; and replace the \ with :\. Since \ is a reserved character in PowerShell, you will need to escape it using a \ Smile

(Get-Content names.csv) | Foreach-Object {$_ -replace ‘\\’, ‘:\’} | Set-Content names.csv

IVC-0680

Step 6. The Single Shell Line to replace the Permissions on everyone’s calendar, to grant the Default User the permission of “Reviewer”.

Running this line will open every mailbox, and set the permission of the default user to Reviewer:

Import-Csv Names.csv | % { Set-MailboxFolderPermission -Identity $_.Identity -AccessRights Reviewer -User Default}

IVC-0681

Checking with Koen’s “Agenda” the script has run successfully Smile

Checking with OWA, it has definitely run successfully Smile

IVC-0683

 

Mission accomplished!

Ilse


Comments (3)

  1. Ståle Hansen says:

    I have created a script for Exchange 2010 that can be reused for Office 365. I demoed it in TechDays in Norway. You dont have to use csv file to import users.

    msunified.net/…/script-set-calendarpermissions-ps1

  2. show box says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings.
    http://www.showboxforipad.org/showbox-apk/ Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android. The above
    all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.
    http://www.showboxforipad.org/
    http://movieboxappdownloads.com/moviebox-apk-android/
    http://movieboxappdownloads.com/download-moviebox-pc/
    Movie Box, an esteemed movies application in which you can find stacks of programs and films. The guide is given here to download Movie Box app to Android and to Apple iOS 9.0.2, iOS 8.4/8.3 and also for the lower versions without Jailbreak.
    http://showboxforiphone.org/
    Please do login to Showbox application with the help of Ymail. You can login in Ymail from here –
    http://ymaillogintips.com/
    Sign Up & Do registration for latest movies on Showbox application

  3. show box says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings.
    http://www.showboxforipad.org/showbox-apk/ Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android. The above
    all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.
    http://www.showboxforipad.org/
    http://movieboxappdownloads.com/moviebox-apk-android/
    http://movieboxappdownloads.com/download-moviebox-pc/
    Movie Box, an esteemed movies application in which you can find stacks of programs and films. The guide is given here to download Movie Box app to Android and to Apple iOS 9.0.2, iOS 8.4/8.3 and also for the lower versions without Jailbreak.
    http://showboxforiphone.org/
    Please do login to Showbox application with the help of Ymail. You can login in Ymail from here –
    http://ymaillogintips.com/
    Sign Up & Do registration for latest movies on Showbox application