Get Calendar permissions for all users in a specific OU and output to CSV

ExchangeKB
ExchangeKB used Ask the Experts™
on
Hi, got a exchange 2010 server, need to output this to migrate perms to o365
Get Calendar permissions for all users in a specific OU and output to CSV

Also need to do the same for send on behalf permissions for all users in specified and output to csv
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Engineer
Distinguished Expert 2017
Commented:
I don't know how to make CSV file but this script is making txt file with coma delimiter so you can easily import to Excel and save as CSV

$boxen = get-mailbox -Resultsize Unlimited
foreach ($box in $boxen) {
    $addresses = $box.EmailAddresses
    foreach ( $address in $addresses ) {
        [string]$ID = $address.AddressString
        write-host ID1 $ID
        $ID += ":\Calendar"
        $permissions = get-mailboxfolderpermission $ID
        write-host ID: $ID
        foreach ( $perm in $permissions ) {
            $mailbox = $address
            $granteduser = $perm.User
            $access = $perm.AccessRights
            $identity = $perm.Identity
            $valid = $perm.IsValid
            if ( $identity -ne "Anonymous" ) {
                $outstring = "$mailbox,$granteduser,$identity,$access,$valid`n"
                $output += $outstring
                write-host $outstring
            }
        }
    }
}
set-content C:\temp\out.txt $output

Open in new window


save it as permissions.ps1 and run in powershell

.\permissions.ps1
Alan CoxSr. Architect | Consulting

Commented:
Permissions do migrate if you use aad connect and hybrid which is the way I would migrate.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial