Category Archives: Powershell

Exporting shared mailbox permissions to a CSV

A demonstration of one way to get shared mailbox permissions exported to a CSV file. We needed both users, groups and users in groups (so, a recursive search). Only Shared mailboxes had to be included, we could identity these by a simple rule:

the first portion of the primary email address does not contain a dot

See line 126 and 127 for this rule if you need a different method.

Edit: make sure you replace CED\ with your own domain! Sorry bout that…

This export excludes Deny permissions and looks for users in groups up to 2 levels deep. Credits to Piotrek for his Get-ADNestedGroupMember function.

Script source: Continue reading Exporting shared mailbox permissions to a CSV

O365Migrator v0.9 released!

Version 0.9 of O365Migrator is now available as a free download.

What was changed?

  • Differential transfer: upload only changed/new files. (does not process renames, moves and deletes yet!)
  • Subfolder targeting: upload to a specific subfolder instead of the root if specified
  • Better library name detection when admin and user have different language settings

You can find the new version here.

Exchange 2007 or 2010 Public Folder report incl rights, email addresses and size

Because I couldn’t quickly find a good script/tool to make a report of my Public Folders that includes a complete drilldown including if they’re mail enabled, what email addresses it has, who has rights on the folder and what size the folders are, I’m sharing this script with you 🙂

Edit: added support for Exchange 2010, uncomment the correct section and comment the 2007 code if you run this on 2010.

Continue reading Exchange 2007 or 2010 Public Folder report incl rights, email addresses and size

Setting calendar permission in bulk

A simple snippet that’ll allow you to give a certain group PublishingAuthor rights to all calendars in your organization:


$mailboxes = get-mailbox -Resultsize Unlimited
foreach ($mailbox in $mailboxes){
try{
Remove-MailboxFolderPermission -Identity "$($mailbox.alias):\Calendar" -User INSERTUSERORGROUPNAMEHERE -Confirm:$False -ErrorAction Stop | Out-Null
Add-MailboxFolderPermission -Identity "$($mailbox.alias):\Calendar" -User INSERTUSERORGROUPNAMEHERE -AccessRights PublishingEditor -ErrorAction Stop | Out-Null
Write-Host "$($mailbox.alias) processed" -ForeGroundColor Green
}catch{
Write-Host "$($mailbox.alias) failed" -ForeGroundColor Red
}

}

A warning though, calendar permissions in Exchange Online can easily become corrupted. I’ve been in touch with support several times, but their only fix is to tell the user to remove and reapply the permissions, which is a sure way to annoy your users during migration.

So, communicate this in advance!

Exchange Forwarding Report

This powershell snippet will tell you which mailbox is actively forwarding email, in what method (dual delivery or pure forwarding), to which email address and if the corresponding contact still exists and is active.

#Module name: findForwarderDetails
#Author: Jos Lieben (OGD)
#Date: 01-04-2016
#Description: this snippet will discover all active forwarders in your organization, and will print the original mailbox, target contact and target address and forwarding method

$output = @()
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where {$_.ForwardingAddress -ne $Null}

foreach ($mailbox in $mailboxes){

    $obj = New-Object PSObject
    $obj | Add-Member NoteProperty mailboxName($mailbox.DisplayName)
    if($mailbox.DeliverToMailboxAndForward){
        $obj | Add-Member NoteProperty forwardingMode("Dual delivery")
    }else{
        $obj | Add-Member NoteProperty forwardingMode("Forward Only")
    }
    try{
        $contact = Get-MailContact -Identity $mailbox.ForwardingAddress.DistinguishedName -ErrorAction Stop
        $obj | Add-Member NoteProperty forwardingToName($contact.DisplayName)
        $obj | Add-Member NoteProperty forwardingToEmail($contact.ExternalEmailAddress)
    }catch{
        $obj | Add-Member NoteProperty forwardingToName("CONTACT DOES NOT EXIST OR IS DISABLED")
        $obj | Add-Member NoteProperty forwardingToEmail("CONTACT DOES NOT EXIST OR IS DISABLED")
    }
    $output += $obj
}

Write-Output $output