Novell Home

IDM Support for Exchange 2007

Novell Cool Solutions: Tip
By Yancey Yeargan

Digg This - Slashdot This

Posted: 30 May 2007
 

Problem

A Forum reader recently asked:

"Anyone know if there is any forecast on availability of Exchange 2007 support for Identity Manager?"

And here's the response from Yancey Yeargan ...

Solution

It's coming. In the meantime, here is a work-around:

1. Configure Identity Manager to write a "mail alias" to extendedAttribute15 (or one of the other 14).

2. Run the PowerShell script (see below) on the Exchange server, or any server with the Exchange Management Console installed.

3. Be sure to customize the script for your environment.

In plain language, this script scans Active Directory for users where the extendedAttribute15 is set, but the homeMDB attribute is NOT set. For every such user it finds, it builds and executes a PowerShell command to create a mailbox for that user.

The script loops after each scan, pausing for the specified number of seconds. Of course, the script can be enhanced in various ways.

---begin---

# How long to wait between searches
$intSleepTime = 60;


# This is the search base
$objRoot = New-Object DirectoryServices.DirectoryEntry 
'LDAP://contoso.com/CN=Users;DC=contoso;DC=com'

# Create a "DirectorySearcher" object
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher

# Set the search root
$objSearcher.SearchRoot = $objRoot

# Find AD users with an Exchange "extensionAttribute15" set but no 
homeMDB set
$objSearcher.Filter = 
("(&(objectCategory=user)(extensionAttribute15=*)(!(homeMDB=*)))")

# Return these attributes for matched users
$colProplist = "name", "canonicalName", "extensionAttribute15", 
"displayName"
foreach ($i in $colPropList)
{
   $howManyProperties = $objSearcher.PropertiesToLoad.Add($i)
}


while ($true)
{

   #Write-Host "Searching...";

   # Perform AD search
   $colResults = $objSearcher.FindAll()

   #Write-Host "Waiting for $($intSleepTime) seconds...";
   start-sleep $intSleepTime > $null;

   # Act on any users that were returned
   foreach ($objResult in $colResults)
   {

     $objUser = $objResult.Properties;

     #Write-Host "Account Name (CN): $($objUser.name)";

     #Write-Host "Display Name: `"$($objUser.displayname)`"";

     #Write-Host "Alias (mailNickname): $($objUser.mailnickname)";

     #Write-Host "extensionAttribute15: $($objUser.extensionAttribute15)";

     #Write-Host "canonicalName: $($objUser.canonicalname)";

     #Write-Host "ADSpath: $($objUser.adspath)";

     Write-Host "Provisioning mailbox for '$($objUser.displayname)' 
($($objUser.name)) with alias '$($objUser.extensionAttribute15)' ...";

     $strDisableCmd = "Disable-Mailuser
       -Identity '$($objUser.canonicalname)'";

     Write-Host "Invoking: `"$($strDisableCmd)`"";

     $ConfirmPreference = 'None';
     Invoke-Expression $strDisableCmd;
     $ConfirmPreference = 'High';


     $strEnableCmd = "Enable-Mailbox
       -Identity `"$($objUser.canonicalname)`"
       -Alias `"$($objUser.extensionAttribute15)`"
       -Database `"EXCHANGE1\Mailbox Database`"";

     Write-Host "Invoking: `"$($strEnableCmd)`"";

     $ConfirmPreference = 'None';
     Invoke-Expression $strEnableCmd;
     $ConfirmPreference = 'High';


     #Write-Host "`n";

   }

}

---end---


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell