Tools for Moving to a Microsoft Collaboration Platform

Blogs about the tools and solutions used in moving to a Microsoft collaboration platform.

merge-dominoUser.ps1 a powershell script for move-dominoUser cmdlet

merge-dominoUser.ps1 a powershell script for move-dominoUser cmdlet

  • Comments 1
  • Likes

# merge-DominoUser.ps1

# ------------- DISCLAIMER -----------------------

# The code herein is provided as is with no gurantee or waranty concerning

# the usability or impact on your messaging system and may be used, distributed

# or modified for use provided the parties agree and acknowledge the Microsoft or

# Microsoft Partners have neither accountabilty or responsibility for results

# produced by use of this script.

# Developed by Jeff Kizner, Brad Hughes and Ed Thornburg

# -------------------------------------------------

# The script below provides the same functionality as move-dominoUser but does not enable

# the email address policy generator [RUS]. The default behavior of move-dominoUser is to

# mailbox enable the user object, apply email address policy as primary addresses and

# then add email addresses from contacts as secondary email addresses. If you intend to

# persist contact email addresses as primary email addresses of the mailbox enabled user,

# then this script is for you.


# The script takes a csv with header of samAccountName,InternetAddress and

# mailbox enables the user object matching the samAccountName and merging

# the contact with the matching primary smtp address.

# In this case the DisplayName is persisted as well.


# The minimum csv header: samAccountName,InternetAddress,displayName


# The script has four major sections, each of which can be run independently

# in sequence; a variable delay timer separates the major sections and is

# implementedto accomodate for directory replication latency


# process flow:

# add the heading for Domino directory values to be persisted to Active Directory

# note that the combinedObjectData merges the attribute data from the csv and

# the contact for the associated user into the same object and that object

# is finally exported to csv to provide the data for the enable-mailbox cmdlet

# the last part adds specific data to the mailbox enabled user


# -verbose provides realtime viewing of operations

start-transcript .\move-dominoUserScript.txt

# $netbiosDomainName = is a static definition of the netbios domain name of your active directory forest

# this value combined with the samaccountname;

# cmdlets accept domain\samaccountname for -identity switch

$netbiosDomainName = "Your_netBIOS_domain"

# ParseEmailAddresses function is necessary as contact.emailAddresses returns an array object;

# not the content of the array.

function ParseEmailAddresses([object[]] $addresses)


$sbAddress = New-Object System.Text.StringBuilder;

$tmp = $sbAddress.Append($addresses[0])

for($x = 1; $x -lt $addresses.Length; $x++)


$tmp = $sbAddress.AppendFormat(",{0}",$addresses[$x]);




# end function

# the code below merges the data for each entry in the csv

# with data from the contact that corresponds to that entry in the csv

# the combined data is in turn written to a csv containing all data

# necessary to persist the data for the mailbox enabled user

$dominoExportData = Import-Csv .\migrationList.csv


$combinedObjectData = $dominoExportData | foreach {

$contactInfo = Get-MailContact -Identity $_.InternetAddress | Select-Object PrimarySmtpAddress,LegacyExchangeDN,EmailAddresses;

Add-Member -InputObject $_ -MemberType NoteProperty -Name PrimarySmtpAddress -Value $contactinfo.PrimarySmtpAddress;

Add-Member -InputObject $_ -MemberType NoteProperty -Name LegacyExchangeDN -Value $contactinfo.LegacyExchangeDN;

$strAddress = ParseEmailAddresses($contactinfo.EmailAddresses);

Add-Member -InputObject $_ -MemberType NoteProperty -Name EmailAddresses -Value $strAddress;



$combinedObjectData | Export-Csv -NoType .\mkmbx.csv

# variable delay timer to accomodate directory replication latency

sleep -seconds 60


import-csv MigrationList.csv | foreach {

get-mailcontact -identity $_.internetaddress | remove-mailcontact -confirm:$FALSE


# variable delay timer to accomodate directory replication latency

sleep -seconds 60


import-csv mkmbx.csv | foreach {

$targetdatabase = ((get-mailbox -resultsize unlimited | group-object -Property database | select-object name,count | sort-object -Property count)[0].name)

Enable-Mailbox -Identity "$netbiosDomainName\$($_.samAccountName)" -database $targetdatabase -ManagedFolderMailboxPolicyAllowed:$TRUE -ActiveSyncMailboxPolicy "Default" -ManagedFolderMailboxPolicy "Empty Deleted Items" -confirm:$FALSE


# variable delay timer to accomodate directory replication latency

sleep -seconds 120

# code adds to the previously enabled mailbox

import-csv mkmbx.csv | foreach {

$mailaddr = $_.emailaddresses

$mailaddr = $mailaddr.Split(",")

# add the legacyExchangeDN of the contact as X500 of user to allow

# for reply to mail sent when user was in foreign system


$mailaddr += "x500:$($_.LegacyExchangeDN)"

set-mailbox -Identity "$netbiosDomainName\$($_.samAccountName)" -EmailAddressPolicyEnabled $false -PrimarySmtpAddress $_.primarySMTPAddress -verbose

set-mailbox -Identity "$netbiosDomainName\$($_.samAccountName)" -EmailAddresses $mailaddr -verbose

set-casmailbox -Identity "$netbiosDomainName\$($_.samAccountName)" -ActiveSyncEnabled $FALSE -IMAPEnabled $FALSE -POPEnabled $FALSE -verbose

# persist displayName from csv input file

Set-User -Identity $_.samAccountName -DisplayName $_.displayName.Trim() -verbose



  • Some time ago I blogged about my experience with the Transporter Suite when migrating from Lotus Notes

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment