Exchange Folder Permissions - query users access to all calendars

I'm trying to get a script working without any success which I'm hoping someone will already have a similar one for I could take.

Basically it needs to run a command like get-mailboxfolderpermissions -identity user:\calendar -user username >> c:\results.text

Basically I need it to check all accounts in the exchange server for a specific account with permissions over its calendar. So in essence check all folder calendar permissions for all mailboxes and if it matches -user, then wrote back to a file the calendar samaccountname they have access to.

Seems long winded but the only way in outlook 2010 to check what permissions a user has over all other calendars that are not provided via full access or inherited permissions.

Ideas appreciated.

Thanks


  • Edited by Tarrley Tuesday, September 01, 2015 7:00 PM More descriptive
  • Moved by Bill_Stewart 17 hours 12 minutes ago Move to more appropriate forum
September 1st, 2015 6:45pm

OK, that does work however if you have mailboxes in different languages as it's matching the name Calendar, it won't work for other languages that use variations such as Calendrier (French).

Without having to define each variation of the word calendar and adding this as another action, is there anyway for this script to apply to anything matching FolderType Calendar, rather than name?

Thanks

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 4:15am

OK, in line with the above, is there a way to hide the errors where it cannot find a folder called Calendar from appearing as an error on the host? I've tried adding an ErrorActionPreference but still see errors such as the below due to the calendar naming not being English.

The operation couldn't be performed because 'username:\Calendar' couldn't be found.
    + CategoryInfo          : NotSpecified: (:) [Get-MailboxFolderPermission], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : BB9413F1,Microsoft.Exchange.Management.StoreTasks.GetMailboxFolderPermission

$ErrorActionPreference = "SilentlyContinue"
$userToCheck = Read-Host 'Enter username'
$Filename = Read-Host 'Enter Filename to create'
$data = Get-Mailbox -ResultSize Unlimited

foreach ($mbx in $data) {

    $calendarPermissions = Get-MailboxFolderPermission "$($mbx.Name):\Calendar"

    foreach ($permissionEntry in $calendarPermissions) {

        If ($permissionEntry.User.ADRecipient.SamAccountName -eq $userToCheck) {

           Write-Host "User $userToCheck has permission on $($mbx.Name) calendar" | Out-File c:\$filename.txt
        }

    }

}



  • Edited by Tarrley 21 hours 41 minutes ago update block
September 2nd, 2015 5:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics