Category Archives: Exchange 2007

Public Folder to Office 365 Groups Migration Script

Earlier, I wrote on a new technet article that details migration to Office 365 groups from on prem public folders. Actually walking through that I noticed some inconveniences I figured I could improve on with a script. The main one being that the endpoint in Office 365 only supports a single Public Folder, excluding child folders.

So I wrote up a script (with resume support) that will map your Public Folders to O365 Groups and migrate them in as many batches as are required, fully automated.

You’ll end up with a nice csv file with all the details. Note:

  1. this script expects you to know what you’re doing!
  2. only tested with Exchange 2010 as source
  3. everything on prem is left untouched
  4. groups are not mail enabled, and security settings are not copied
  5. contacts are not copied
  6. make sure you read the code/in-script instructions between line 1 and line 48, and then if you’re curious, from line 71720

https://gitlab.com/Lieben/assortedFunctions/blob/master/archivePublicFoldersToOffice365Groups.ps1

update 05/01: improved the connection status check + reconnect for remote ExO and fixed report file path auto generation

update 11/01: moved everything to start-job so exchange sessions are always isolated (no prompting after 1-2 days) and added total migration overview display 

update 25/01: exported the remote exchange module and added it as inline code with a modification so it won’t prompt for credentials, nothing else seems to otherwise prevent such prompts. This means the module may not match Microsoft’s if they update Exchange Online. Let me know if that causes issues for you or re-create it yourself with export-pssession and replace.

Migrating Public Folders to Office 365 Groups

Recently, I stumbled upon an article detailing how to migrate on-premises (or online) Public Folders to Office 365 Groups

Of course I had to try that out asap 🙂 I used an older script to make a report of my on prem public folders to pick one below 50GB.

It was mostly a breeze and the interface of Office 365 groups allows users to easily search and administer their old Public Folders. We purposely only use them for archive access, where the IM team manages access to the groups holding PF data. I can really recommend this strategy, especially if you can easily split them up in under 50GB sized groups.

I did have one slight error you may run into:

“MigrationTransientException: Couldn‎’t find a request that matches the information provided. Reason: No such request exists in the specified index. –> Couldn‎’t find a request that matches the information provided. Reason: No such request exists in the specified index. “

Reason for this: The source public folder path is incorrect, make sure your CSV is mapped correctly or your batch will spin forever (or at least longer than I had patience), never completing.

 

 

Quick overview of all unique email domains in use under a certain OU

We wanted an overview of which domains our users were using in a certain country (Netherlands in this case). So, a simple Powershell snippet that counts all unique domains it encounters in the ProxyAddresses field of all users under a certain OU.

Note that if you have set contacts / forwarders, some domains that appear may not actually be accepted domains in your exchange organization.

</p>
<p>#Author: Jos Lieben (OGD)<br />
#Date: 13-06-2016<br />
#Script help: www.liebensraum.nl<br />
#Purpose: retrieve all unique domains in use under a specific OU and count them<br />
#Requirements:<br />
#active directory PS module<br />
########</p>
<p>ipmo activedirectory</p>
<p>$users = get-aduser -Filter * -Properties * -SearchBase &quot;OU=Netherlands,OU=Countries,DC=lieben,DC=nu&quot; -SearchScope SubTree</p>
<p>$domains = @{}<br />
foreach($user in $users){</p>
<p>$emails = $user.ProxyAddresses<br />
foreach($email in $emails){<br />
$domain = $email.Split(&quot;@&quot;)[1]<br />
if($domain){<br />
$domains[$domain] += 1<br />
}<br />
}</p>
<p>}</p>
<p>Write-Output $domains

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

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

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.

<br />
#Module name: findForwarderDetails<br />
#Author: Jos Lieben (OGD)<br />
#Date: 01-04-2016<br />
#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</p>
<p>$output = @()<br />
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where {$_.ForwardingAddress -ne $Null}</p>
<p>foreach ($mailbox in $mailboxes){</p>
<p>    $obj = New-Object PSObject<br />
    $obj | Add-Member NoteProperty mailboxName($mailbox.DisplayName)<br />
    if($mailbox.DeliverToMailboxAndForward){<br />
        $obj | Add-Member NoteProperty forwardingMode(&quot;Dual delivery&quot;)<br />
    }else{<br />
        $obj | Add-Member NoteProperty forwardingMode(&quot;Forward Only&quot;)<br />
    }<br />
    try{<br />
        $contact = Get-MailContact -Identity $mailbox.ForwardingAddress.DistinguishedName -ErrorAction Stop<br />
        $obj | Add-Member NoteProperty forwardingToName($contact.DisplayName)<br />
        $obj | Add-Member NoteProperty forwardingToEmail($contact.ExternalEmailAddress)<br />
    }catch{<br />
        $obj | Add-Member NoteProperty forwardingToName(&quot;CONTACT DOES NOT EXIST OR IS DISABLED&quot;)<br />
        $obj | Add-Member NoteProperty forwardingToEmail(&quot;CONTACT DOES NOT EXIST OR IS DISABLED&quot;)<br />
    }<br />
    $output += $obj<br />
}</p>
<p>Write-Output $output<br />

Exchange 2007 Hybrid Migration to Office 365 with Exchange 2013 Coexistence

During a migration for a customer from an Exchange 2007 environment, to Office 365, I ran into some issues that I’d like to share, as I could not find any material on this subject elsewhere.

Our plan was easy, update the Exchange 2007 servers to the latest Servicepack and CU to allow coexistence with an Exchange 2013 server as detailed on technet. I’d then build up the Hybrid relationship on the 2013 machine, move the mailboxes and phase out the 2007 machines. The 2013 machine would remain for on-premises Lync connectivity, which needs a CAS to talk to.

Once the Exchange 2013 server was installed, I prepared the machine for Hybrid connectivity, added the relevant domains to Office 365 and started the Hybrid setup wizard from the Exchange 2013 ECP.

I received the following error:

[PS] C:\Windows\system32&gt;Get-WebServicesVirtualDirectory
An IIS directory entry couldn't be created. The error message is Access is denied.
. HResult = -2147024891
    + CategoryInfo          : NotInstalled: (EXCH2007-1\EWS (Default Web Site):ADObjectId) [Get-WebServicesVirtualDirect
   ory], IISGeneralCOMException
    + FullyQualifiedErrorId : [Server=EXCH2013,RequestId=f962a8dd-2d39-4b36-85c3-a16a15fc3252,TimeStamp=9-6-201
   5 07:50:59] [FailureCategory=Cmdlet-IISGeneralCOMException] 18EA544C,Microsoft.Exchange.Management.SystemConfigura
  tionTasks.GetWebServicesVirtualDirectory
    + PSComputerName        : exch2013.fqdn

An IIS directory entry couldn't be created. The error message is Access is denied.
. HResult = -2147024891
    + CategoryInfo          : NotInstalled: (EXCH2007-2\EWS (Default Web Site):ADObjectId) [Get-WebServicesVirtualDirect
   ory], IISGeneralCOMException
    + FullyQualifiedErrorId : [Server=EXCH2013,RequestId=f962a8dd-2d39-4b36-85c3-a16a15fc3252,TimeStamp=9-6-201
   5 07:50:59] [FailureCategory=Cmdlet-IISGeneralCOMException] 18EA544C,Microsoft.Exchange.Management.SystemConfigura
  tionTasks.GetWebServicesVirtualDirectory
    + PSComputerName        : exch2013.fqdn

The hybrid wizard aborted, and could not continue.
The Get-WebServicesVirtualDirectory command checks all Continue reading Exchange 2007 Hybrid Migration to Office 365 with Exchange 2013 Coexistence