{"id":579,"date":"2009-11-08T14:23:51","date_gmt":"2009-11-08T14:23:51","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=579"},"modified":"2010-01-21T13:51:08","modified_gmt":"2010-01-21T13:51:08","slug":"managing-exchange-200020032007-with-ilm-2007","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/managing-exchange-200020032007-with-ilm-2007","title":{"rendered":"Managing Exchange 2000\/2003\/2007 with ILM 2007"},"content":{"rendered":"<p>I have just posted\u00c2\u00a0this article in the Greatest Hits series on the ILM Technet forum.<\/p>\n<p><a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en-US\/identitylifecyclemanager\/thread\/f8ad045d-7252-4cd1-a189-d704a8f99129\">http:\/\/social.technet.microsoft.com\/Forums\/en-US\/identitylifecyclemanager\/thread\/f8ad045d-7252-4cd1-a189-d704a8f99129<\/a><\/p>\n<p>The article covers various management tasks you can acheive with the standard AD MA, including provisioning and updating of users, mailboxes, contacts and distribution groups. There are quite a few code samples as well.<!--more--><\/p>\n<h2>Managing Exchange 2000\/2003\/2007 with ILM 2007<\/h2>\n<p>This article covers the management of Exchange-enabled objects using the native Active Directory Management Agent that is included with ILM 2007 FP1.<\/p>\n<p>The managed object types discussed are Users, Contacts, Groups and Dynamic Distribution Lists. The article also covers the special cases of adding mailboxes to existing accounts, and supporting a Resource Forest. Where extra steps are required for Exchange 2007 this has been highlighted.<\/p>\n<p>It is assumed that the reader is comfortable with the concepts of Provisioning code and Advanced attribute flow rules.<\/p>\n<h2 style=\"color: #365f91;\">Permissions<\/h2>\n<p>The service account used in the connection properties of the Management Agent must have sufficient rights to execute the required changes in AD.<\/p>\n<p>Typically a Domain Admin account will be used, but if this is not permitted in your environment you will need to do some testing. The minimum permissions required are:<\/p>\n<ul>\n<li><a href=\"http:\/\/support.microsoft.com\/kb\/303972\">Replicate Directory Changes<\/a><\/li>\n<li>Rights to create\/delete\/modify objects in the specific OUs<\/li>\n<li>Exchange Administrator (2003) or Exchange Recipient Administrator (2007)<\/li>\n<\/ul>\n<p>\u00c2\u00a0<\/p>\n<h2 style=\"color: #365f91;\">Users<\/h2>\n<h3 style=\"color: #365f91;\">Provisioning Mail Users<\/h3>\n<h4 style=\"color: #365f91;\">Exchange 2000\/2003<\/h4>\n<p>Provisioning a mail user is most simply done using the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms696038(VS.85).aspx\">CreateMailbox<\/a> method of the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms696074(VS.85).aspx\">ExchangeUtils<\/a> class. This method will create a new user account, and populate the necessary mail attributes for you.<\/p>\n<p>See the code sample <span style=\"text-decoration: underline;\">Create a User with a Mailbox<\/span> at the end of this document for an example of the provisioning code.<\/p>\n<h4 style=\"color: #365f91;\">Mixed Exchange 2003 and 2007<\/h4>\n<p>In a mixed environment the RUS still runs so Exchange 2003 methods may be used. Make sure that you do <strong>not<\/strong> tick the \u00e2\u20ac\u0153Enable Exchange 2007 provisioning\u00e2\u20ac\u009d box in the Management Agent configuration.<\/p>\n<h4 style=\"color: #365f91;\">Exchange 2007<\/h4>\n<p>The same code will work when provisioning to Exchange 2007, however there are some extra requirements for the ILM server:<\/p>\n<ul>\n<li>ILM 2007 FP1 or later<\/li>\n<li>Powershell<\/li>\n<li>Exchange 2007 Management Tools<\/li>\n<li>Latest rollup packs on Exchange and ILM servers<\/li>\n<\/ul>\n<p>In addition you must tick Enable Exchange 2007 provisioning on the Extensions tab of the Management Agent.<\/p>\n<h4 style=\"color: #365f91;\">Adding a Mailbox to an existing User<\/h4>\n<p>Sometimes you may need to create a mailbox for an existing account. As the account already exists this is not actually a provisioning task, and is therefore handled with export flow rules.<\/p>\n<p>All you need to do is to populate the following attributes, in addition to the basic user attributes:<\/p>\n<ul>\n<li>displayName \u00e2\u20ac\u201c if not already set<\/li>\n<li>mailNickname \u00e2\u20ac\u201c with the local part of the email address (the bit before the \u00e2\u20ac\u0153@\u00e2\u20ac\u009d)<\/li>\n<li>homeMDB \u00e2\u20ac\u201c with the DN of the mail store<\/li>\n<li>mDBUseDefaults \u00e2\u20ac\u201c set to \u00e2\u20ac\u0153True\u00e2\u20ac\u009d to use the default quota settings<\/li>\n<\/ul>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Special Mailbox Types<\/h3>\n<p>Exchange 2007 includes some extra mailbox types:<\/p>\n<ul>\n<li>Room Mailbox,<\/li>\n<li>Equipment Mailbox,<\/li>\n<li>Linked Mailbox.<\/li>\n<\/ul>\n<p>The Linked Mailbox is covered in the <span style=\"text-decoration: underline;\">Resource Forest<\/span> section below.<\/p>\n<p>The Room and Equipment mailboxes are currently not supported by ILM 2007 provisioning. The only reliable method is to create a User Mailbox using ILM 2007, and then use the set-mailbox cmdlet to change the mailbox type.<\/p>\n<h4 style=\"color: #365f91;\">Troubleshooting<\/h4>\n<h5 style=\"color: #365f91;\">Export Errors<\/h5>\n<p>The most common problems with provisioning Exchange users will relate to permissions. Make sure that the account used by the MA to connect to AD has permission to create Exchange users. Also make sure you have the latest service packs and rollups on the Exchange and ILM servers \u00e2\u20ac\u201c at least SP1 RU9.<\/p>\n<h5 style=\"color: #365f91;\">Where\u00e2\u20ac\u2122s the Mailbox?<\/h5>\n<p>Exchange does not create the actual mailbox until it is opened or something is sent to it, therefore it is completely normal for no new mailboxes to be listed directly after the ILM export.<\/p>\n<p>To confirm if the user is really mail-enabled:<\/p>\n<ul>\n<li>In Exchange 2003, check that the user\u00e2\u20ac\u2122s Exchange tabs have appeared in the Exchange-enhanced version of AD Users &amp; Computers.<\/li>\n<li>In Exchange 2007, use the get-user cmdlet to confirm the user\u00e2\u20ac\u2122s object type is \u00e2\u20ac\u0153UserMailbox\u00e2\u20ac\u009d, or check that they appear as a Recipient in the Management Console.<\/li>\n<\/ul>\n<p>\u00c2\u00a0<\/p>\n<h5 style=\"color: #365f91;\">Exchange 2007 and Global Catalog targeting<\/h5>\n<p>There is a known problem with Exchange 2007 provisioning and AD replication delays. On the MA\u00e2\u20ac\u2122s Configure Directory Partitions tab you can hard-code the name of a preferred domain controller. Enter the name of the nearest Global Catalog to ensure that both the user creation and the mailbox creation are performed in the same place.<\/p>\n<table style=\"width: 100%;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<th style=\"text-align: left; background-color: #c0c0c0;\"><img decoding=\"async\" src=\"http:\/\/apfhrw.bay.livefilestore.com\/y1pCed6u9dxDV3LOdzgtYt8xFaDWmIf_thMiOiFb3SmUARdxwIei5b6sPCHGruZWYphrJEU8j2BZEd51ZoAkp_ONkG8moMODvLC\/Note.gif\" alt=\"note\" \/>Note<\/th>\n<\/tr>\n<tr>\n<td style=\"background-color: #f0f0f0;\">Use the Resource Kit utility nltest to find Global Catalog servers:<br \/>\n<em>nltest \/DSGETDC:mydomain.com \/GC<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Modifying Mail Users<\/h3>\n<p>You can change a user\u00e2\u20ac\u2122s Exchange related attributes using export flow rules.<\/p>\n<p>The following table is not exhaustive. If you wish to automate an Exchange modification the best thing to do is make the change manually and then inspect the attribute changes using ADSIEdit.<br \/>\nIn this way you can discover which attributes you need to create flow rules for, and the types of value you should flow.<\/p>\n<table border=\"0\">\n<tbody>\n<tr>\n<th style=\"text-align: center; background-color: #d4d0c8; padding-left: 5px; padding-right: 5px; font-weight: bold;\">Attribute<\/th>\n<th style=\"text-align: center; background-color: #d4d0c8; padding-left: 5px; padding-right: 5px; font-weight: bold;\">Function<\/th>\n<th style=\"text-align: center; background-color: #d4d0c8; padding-left: 5px; padding-right: 5px; font-weight: bold;\">Comments<\/th>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">altRecipient<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Used in forwarding \u00e2\u20ac\u201c the DN or the mail-enabled object to forward all mail to.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">When forwarding mail to an external account you must create a Contact object in this Exchange organization.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">deliverAndRedirect<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">If forwarding is enabled, set to TRUE to deliver to both the mailbox and the forwarding address.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Use in combination with altRecipient.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">extensionAttributen<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Free-use string attributes where you can store any data you like.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Be consistent. If extensionAttribute4 is being used for star sign, then make sure it is only ever used for that.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">homeMDB<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Location of the mailbox.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Do NOT change once it has been set. If you need to move the mailbox use Exchange admin utilities.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mail<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The user\u00e2\u20ac\u2122s primary email address.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">If changing the address you should also change mailNickname and the \u00e2\u20ac\u0153SMTP:\u00e2\u20ac\u009d value of proxyAddresses.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mailNickname<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">This should match the local part of the primary email address.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mDBUseDefaults<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Use the default quota for the mail store.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Set to False if setting an individual limit.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mDBStorageQuota<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The \u00e2\u20ac\u0153Warning\u00e2\u20ac\u009d limit Expressed in Kbytes.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mDBOverQuotaLimit<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The \u00e2\u20ac\u0153Block Send\u00e2\u20ac\u009d limit Expressed in Kbytes.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mDBOverHardQuotaLimit<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The \u00e2\u20ac\u0153Block Send &amp; Receive\u00e2\u20ac\u009d limit<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Expressed in Kbytes.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">msExchHideFromAddressLists<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Set to \u00e2\u20ac\u0153True\u00e2\u20ac\u009d to hide from the GAL.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">msExchMailboxGuid<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The unique identifier of the mailbox<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">DON\u00e2\u20ac\u2122T CHANGE THIS! It can be useful to flow this back into the Metaverse if you need to test that the mailbox was created.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">proxyAddresses<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Multivalue attribute holding all possible email addresses for this account<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The capital \u00e2\u20ac\u0153SMTP:\u00e2\u20ac\u009d address is the primary. The other \u00e2\u20ac\u0153smtp:\u00e2\u20ac\u009d addresses act as aliases.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Resource Forest<\/h3>\n<p>In a Resource Forest scenario the following accounts are needed:<\/p>\n<ol>\n<li>An enabled user account in the Account Forest.<\/li>\n<li>A disabled account in the Resource Forest with an attached mailbox.<\/li>\n<\/ol>\n<p>The account creation in the two forests and the mailbox linking are simple enough to achieve with ILM. A provisioning code sample has been included at the end of this document under <span style=\"text-decoration: underline;\">Create Account Forest and Resource Forest Accounts<\/span>.<\/p>\n<p>The difficulty comes with the permissions assignment piece of the puzzle \u00e2\u20ac\u201c it is necessary for the user\u00e2\u20ac\u2122s account to have the <strong>Full Access<\/strong> and <strong>Send As<\/strong> rights to the mailbox. This is not something that is possible with the native Active Directory MA.<\/p>\n<p>While there are several ways to solve the permissions-assignment problem, the typical way is to run a script after the export step. The script might simply trawl AD looking for accounts to update or it could read details from the ILM export log and target the new accounts.<\/p>\n<p>While outside the scope of this document, the following resources have been included for reference:<\/p>\n<ol>\n<li>A <a href=\"http:\/\/support.microsoft.com\/kb\/310866\/en-us\">Microsoft technote<\/a> showing how to Script Exchange 2000\/2003 mailbox permissions,<\/li>\n<li>A PowerShell script for Exchange 2007 has been included in the Code section at the end of this article.<\/li>\n<\/ol>\n<p>\u00c2\u00a0<\/p>\n<h2 style=\"color: #365f91;\">Contacts<\/h2>\n<p>Contacts are used for two primary functions in Exchange, both of which can be automated with ILM:<\/p>\n<ol>\n<li>Adding organization-wide contacts to the Global Address List.<br \/>\nILM could be used to import information from a CRM system and automatically create the contact object.<\/li>\n<li>As a way to forward mail from a mailbox within the organization.<br \/>\nSome organizations (such as universities) allow users to forward their mail to another address. As long as ILM has the information about the forwarding request (perhaps entered by the user in a self-service portal) it can be configured to create the contact and set up the forwarding.<\/li>\n<\/ol>\n<h3 style=\"color: #365f91;\">Provisioning<\/h3>\n<p>Contacts may be provisioned very simply using the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms696036(VS.85).aspx\">CreateMailEnabledContact<\/a> method from the ExchangeUtils class.<br \/>\nSee the code sample <span style=\"text-decoration: underline;\">Create a Contact<\/span> at the end of this document for an example of the provisioning code.<\/p>\n<h3 style=\"color: #365f91;\">Modifying<\/h3>\n<table border=\"0\">\n<tbody>\n<tr>\n<th style=\"text-align: center; background-color: #d4d0c8; padding-left: 5px; padding-right: 5px; font-weight: bold;\">Attribute<\/th>\n<th style=\"text-align: center; background-color: #d4d0c8; padding-left: 5px; padding-right: 5px; font-weight: bold;\">Function<\/th>\n<th style=\"text-align: center; background-color: #d4d0c8; padding-left: 5px; padding-right: 5px; font-weight: bold;\">Comments<\/th>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">mail<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The contact\u00e2\u20ac\u2122s email address.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">If changing the address you should also change targetAddress and the \u00e2\u20ac\u0153SMTP:\u00e2\u20ac\u009d value of proxyAddresses.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">msExchHideFromAddressLists<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Set to \u00e2\u20ac\u0153True\u00e2\u20ac\u009d to hide from the GAL.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">\u00c2\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">proxyAddresses<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">Multivalue attribute holding all possible email addresses that will forward via the contact.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">To work the contact needs an alias using \u00e2\u20ac\u0153smtp:\u00e2\u20ac\u009d in the local domain. The \u00e2\u20ac\u0153SMTP:\u00e2\u20ac\u009d address should match mail and targetAddress.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">targetAddress<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">The email address that mail sent to this contact will be forwarded to.<\/td>\n<td style=\"text-align: left; padding-left: 5px; padding-right: 5px;\">One address only.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00c2\u00a0<\/p>\n<h2 style=\"color: #365f91;\">Distribution List<\/h2>\n<p>There are three types of Distribution list in Exchange:<\/p>\n<ol>\n<li>Groups of type Distribution<\/li>\n<li>Groups of type Security that have an email address<\/li>\n<li>Dynamic distribution lists.<\/li>\n<\/ol>\n<p>All three types can be created and managed with ILM, but the processes will differ.<\/p>\n<h3 style=\"color: #365f91;\">Distribution Groups<\/h3>\n<p>To provision a standard Distribution Group use the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms696024(VS.85).aspx\">CreateDistributionList<\/a> method of the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms696074(VS.85).aspx\">ExchangeUtils<\/a> class. See <span style=\"text-decoration: underline;\">Create a Distribution List<\/span> at the end of this document for a code sample.<\/p>\n<p>The main modification you will do with groups is to update the membership list. Group population is outside the scope of this document, though it is worth looking into Group Populator and Multi-Value tables.<\/p>\n<h3 style=\"color: #365f91;\">Security Groups with Email Address<\/h3>\n<p>It is possible to mail-enable a Security group, allowing it to then also act as a distribution list.<\/p>\n<p>Provisioning such a group is a simple matter of creating a security group and adding the mail address. See <span style=\"text-decoration: underline;\">Create a Mail-Enabled Security Group<\/span> under Code Samples at the end of this document.<\/p>\n<h3 style=\"color: #365f91;\">Dynamic Distribution Lists<\/h3>\n<p>You may also use ILM to provision Dynamic Distribution Lists. All you need to do is to create an object of type msExchDynamicDistributionList and add values to the following attributes:<\/p>\n<ul>\n<li>displayName<\/li>\n<li>mailNickname<\/li>\n<li>msExchDynamicDLFilter<\/li>\n<li>msExchDynamicDLBaseDN<\/li>\n<\/ul>\n<p>See <span style=\"text-decoration: underline;\">Create a Dynamic Distribution List<\/span> under Code Samples at the end of this document.<\/p>\n<h2 style=\"color: #365f91;\">Code Samples<\/h2>\n<h3 style=\"color: #365f91;\">Create a User with a Mailbox<\/h3>\n<p>\u00c2\u00a0<\/p>\n<p>This MVExtension code is in addition to export flow rules to the user object type on the following attributes:<\/p>\n<ul>\n<li>displayName<\/li>\n<li>givenName<\/li>\n<li>sAMAccountName<\/li>\n<li>sn<\/li>\n<li>userPrincipalName<\/li>\n<\/ul>\n<p>\u00c2\u00a0<\/p>\n<pre>Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision\r\n\r\n  Const ADS_UF_NORMAL_ACCOUNT As Integer = &amp;H200\r\n\r\n  Dim csentry As CSEntry\r\n\r\n  Dim MA As ConnectedMA\r\n\r\n  Dim dn As ReferenceValue\r\n\r\n  Dim rdn As String\r\n\r\n  Dim homeMDB As String\r\n\r\n  Dim mailNickname As String\r\n\r\n  Dim mail As String\r\n\r\n  Select Case mventry.ObjectType\r\n\r\n  Case \"person\"\r\n\r\n    MA = mventry.ConnectedMAs(\"MYDOMAIN\")\r\n\r\n    If &lt;test that account should exist&gt; AndAlso MA.Connectors.Count = 0 Then\r\n\r\n      rdn = \"CN=\" &amp; mventry(\"sn\").Value &amp; \", \" &amp; mventry(\"givenName\").Value\r\n\r\n      dn = MA.EscapeDNComponent(rdn).Concat(\"OU=Users,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=mydomain,dc=local\")\r\n\r\n      mailNickname = mventry(\"mailNickname\").Value\r\n\r\n      ' The following line assumes MDB, SG and MailServer have been\r\n\r\n      ' populated for the user in the Metaverse.\r\n\r\n      homeMDB = \"CN=&amp; mventry(\"MDB\").StringValue _\r\n\r\n         &amp; \",CN=\" &amp; mventry(\"SG\").StringValue _\r\n\r\n         &amp; \",CN=InformationStore,CN=\" &amp; mventry(\"MailServer\").StringValue _\r\n\r\n         &amp; \",CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT)\" _\r\n\r\n         &amp; \",CN=Administrative Groups,CN=First Organization\" _\r\n\r\n         &amp; \",CN=Microsoft Exchange,CN=Services,CN=Configuration\" _\r\n\r\n         &amp; \",DC=mydomain,DC=local\"  \r\n\r\n      csentry = ExchangeUtils.CreateMailbox(MA, dn, mailNickname, homeMDB)\r\n\r\n      csentry.DN = dn\r\n\r\n      csentry(\"unicodePwd\").Values.Add(\"FirstP@ssw0rd\")\r\n\r\n      csentry(\"userAccountControl\").IntegerValue = ADS_UF_NORMAL_ACCOUNT\r\n\r\n      csentry.CommitNewConnector()\r\n\r\n    End If\r\n\r\n  End Select\r\n\r\nEnd Sub<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Create Account Forest Accounts and Resource Forest Accounts<\/h3>\n<p>\u00c2\u00a0<\/p>\n<pre>Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision\r\n\r\n  Const ADS_UF_NORMAL_ACCOUNT As Integer = &amp;H200\r\n\r\n  Dim csentry As CSEntry\r\n\r\n  Dim MA As ConnectedMA\r\n\r\n  Dim dn As ReferenceValue\r\n\r\n  Dim rdn As String\r\n\r\n  Dim homeMDB As String\r\n\r\n  Dim mailNickname As String\r\n\r\n  Dim mail As String\r\n\r\n  Select Case mventry.ObjectType\r\n\r\n  Case \"person\"\r\n\r\n    'Create Account Forest account - no mailbox\r\n\r\n    MA = mventry.ConnectedMAs(\"AccountForest\")\r\n\r\n    If MA.Connectors.Count = 0 Then\r\n\r\n      rdn = \"CN=\" &amp; mventry(\"sn\").StringValue _\r\n\r\n                  &amp; \", \" &amp; mventry(\"givenName\").StringValue\r\n\r\n      dn = MA.EscapeDNComponent(rdn).Concat(\"OU=Users,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=accountdomain,dc=local\")\r\n\r\n      csentry = MA.Connectors.StartNewConnector(\"user\")\r\n\r\n      csentry.DN = dn\r\n\r\n      csentry(\"unicodePwd\").Values.Add(\"FirstP@ssw0rd\")\r\n\r\n      csentry(\"userAccountControl\").IntegerValue = ADS_UF_NORMAL_ACCOUNT\r\n\r\n      csentry.CommitNewConnector()\r\n\r\n    End If\r\n\r\n    'Create disabled account and mailbox in Resource forest. \r\n\r\n    '  This can only be done once the objectSID from the account domain \r\n\r\n    '  is available. Create a metaverse Binary attribute called SID\r\n\r\n    '  and flow objectSid -&gt; SID.\r\n\r\n    '  The account is disabled because no password is set. Alternatively set\r\n\r\n    '  a random password and disable using userAccountControl.\r\n\r\n    MA = mventry.ConnectedMAs(\"ResourceForest\")\r\n\r\n    If MA.Connectors.Count = 0 AndAlso mventry(\"SID\").IsPresent Then\r\n\r\n      rdn = \"CN=\" &amp; mventry(\"displayName\").StringValue\r\n\r\n      dn = MA.EscapeDNComponent(rdn).Concat(\"OU=LinkedMailboxes,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=resourcedomain,dc=local\")\r\n\r\n      mailNickname = mventry(\"mailNickname\").StringValue\r\n\r\n      homeMDB = \"CN=\" &amp; mventry(\"MDB\").StringValue _\r\n\r\n         &amp; \",CN=\" &amp; mventry(\"SG\").StringValue _\r\n\r\n         &amp; \",CN=InformationStore,CN=\" &amp; mventry(\"MailServer\").StringValue _\r\n\r\n         &amp; \",CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT)\" _\r\n\r\n         &amp; \",CN=Administrative Groups,CN=First Organization\" _\r\n\r\n         &amp; \",CN=Microsoft Exchange,CN=Services,CN=Configuration\" _\r\n\r\n         &amp; \",DC=mydomain,DC=local\"  \r\n\r\n      csentry = ExchangeUtils.CreateMailbox(MA, dn, mailNickname, homeMDB)\r\n\r\n      csentry.DN = dn\r\n\r\n      csentry(\"msExchMasterAccountSid\").BinaryValue = mventry(\"SID\").BinaryValue\r\n\r\n      'The following setting is optional but can help with tracking the mailbox user.\r\n\r\n       csentry(\"extensionAttribute1\").Value = \"accountdomain\\\" _\r\n\r\n                                              &amp; mventry(\"uid\").StringValue\r\n\r\n       csentry.CommitNewConnector()\r\n\r\n     End If\r\n\r\n  End Select\r\n\r\nEnd Sub<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Assign Resource Mailbox Permissions \u00e2\u20ac\u201c Exchange 2007, powershell<\/h3>\n<p>\u00c2\u00a0<\/p>\n<p>The following script assigns the FullAccess and SendAs permissions to a resource forest mailbox.<br \/>\nThe resource forest account needs to have the domain\\username of the user\u00e2\u20ac\u2122s actual account written to extensionAttribute1, as per the provisioning code above.<\/p>\n<pre>$Filter = \"(&amp;(ObjectCategory=user)(extensionAttribute1=*))\"\r\n\r\n$Searcher = New-Object System.DirectoryServices.DirectorySearcher($Filter)\r\n\r\n$Searcher.Findall() | Foreach-Object -Process {\r\n\r\n$alias = [string]$_.properties.item(\"mailNickname\")\r\n\r\n$user = [string]$_.properties.item(\"extensionAttribute1\")\r\n\r\nAdd-MailboxPermission -Identity $alias -AccessRights FullAccess, SendAs -User $user\r\n\r\n}<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Create a Contact<\/h3>\n<p>\u00c2\u00a0<\/p>\n<pre>Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision\r\n\r\n  Dim csentry As CSEntry\r\n\r\n  Dim MA As ConnectedMA\r\n\r\n  Dim dn As ReferenceValue\r\n\r\n  Dim rdn As String\r\n\r\n  Dim mailNickname As String\r\n\r\n  Dim mail As String\r\n\r\n  Select Case mventry.ObjectType\r\n\r\n  Case \"person\"\r\n\r\n     MA = mventry.ConnectedMAs(\"MYDOMAIN\")\r\n\r\n     If MA.Connectors.Count = 0 Then\r\n\r\n       rdn = \"CN=\" &amp; mventry(\"displayName\").StringValue\r\n\r\n       dn = MA.EscapeDNComponent(rdn).Concat(\"OU=Contacts,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=mydomain,dc=local\")\r\n\r\n       mail = mventry(\"mail\").StringValue\r\n\r\n       'The mailNickname is only for internal Exchange purposes.\r\n\r\n       'You could just as easily use an id number from the source data.\r\n\r\n       mailNickname = mventry(\"mail\").Value.Split(\"@\")(0)\r\n\r\n       csentry = ExchangeUtils.CreateMailEnabledContact(MA, dn, mailNickname, mail)\r\n\r\n       csentry.DN = dn\r\n\r\n       csentry.CommitNewConnector()\r\n\r\n    End If\r\n\r\n  End Select\r\n\r\nEnd Sub<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Create a Distribution List<\/h3>\n<p>\u00c2\u00a0<\/p>\n<pre>Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision\r\n\r\n  Dim csentry As CSEntry\r\n\r\n  Dim MA As ConnectedMA\r\n\r\n  Dim dn As ReferenceValue\r\n\r\n  Dim rdn As String\r\n\r\n  Dim mailNickname As String\r\n\r\n  Dim mail As String\r\n\r\n  Select Case mventry.ObjectType\r\n\r\n  Case \"group\"\r\n\r\n    MA = mventry.ConnectedMAs(\"MYDOMAIN\")\r\n\r\n    If MA.Connectors.Count = 0 Then\r\n\r\n      rdn = \"CN=\" &amp; mventry(\"cn\").StringValue\r\n\r\n      dn = MA.EscapeDNComponent(rdn).Concat(\"OU=Groups,OU=MyOrg, \" _\r\n\r\n                                            &amp;\"dc=mydomain,dc=local\")\r\n\r\n      mailNickname = mventry(\"mailNickname\").StringValue\r\n\r\n      csentry = ExchangeUtils.CreateDistributionlist(MA, dn, mailNickname)\r\n\r\n      csentry.DN = dn\r\n\r\n      csentry.CommitNewConnector()\r\n\r\n    End If\r\n\r\n  End Select\r\n\r\nEnd Sub<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Create a Mail-Enabled Security Group<\/h3>\n<p>\u00c2\u00a0<\/p>\n<pre>Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision\r\n\r\n  Dim csentry As CSEntry\r\n\r\n  Dim MA As ConnectedMA\r\n\r\n  Dim dn As ReferenceValue\r\n\r\n  Dim rdn As String\r\n\r\n  Dim mailNickname As String\r\n\r\n  Dim mail As String\r\n\r\n  Select Case mventry.ObjectType\r\n\r\n  Case \"group\"\r\n\r\n    MA = mventry.ConnectedMAs(\"MYDOMAIN\")\r\n\r\n    If MA.Connectors.Count = 0 Then\r\n\r\n      rdn = \"CN=\" &amp; mventry(\"cn\").StringValue\r\n\r\n      dn = MA.EscapeDNComponent(rdn).Concat(\"OU=Groups,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=mydomain,dc=local\")\r\n\r\n      mailNickname = mventry(\"mailNickname\").StringValue\r\n\r\n      csentry = MA.Connectors.StartNewConnector(\"group\")\r\n\r\n      csentry(\"groupType\").Value = -2147483640  'Universal Security\r\n\r\n      csentry(\"displayName\").Value = mventry(\"cn\").StringValue\r\n\r\n      csentry(\"mailNickname\").Value = mailNickname\r\n\r\n      csentry.DN = dn\r\n\r\n      csentry.CommitNewConnector()\r\n\r\n    End If\r\n\r\n  End Select\r\n\r\nEnd Sub<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h3 style=\"color: #365f91;\">Create a Dynamic Distribution List<\/h3>\n<p>\u00c2\u00a0<\/p>\n<p>This MVExtension code snippet creates Department DDLs.<br \/>\nThe department names have been imported into department objects in the Metaverse.<br \/>\nThe users\u00e2\u20ac\u2122 department attribute matches exactly the department names.<\/p>\n<pre>Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision\r\n\r\n  Dim csentry As CSEntry\r\n\r\n  Dim MA As ConnectedMA\r\n\r\n  Dim dn As ReferenceValue\r\n\r\n  Dim rdn As String\r\n\r\n  Dim mailNickname As String\r\n\r\n  Dim mail As String\r\n\r\n  Select Case mventry.ObjectType\r\n\r\n  Case \"department\"\r\n\r\n    MA = mventry.ConnectedMAs(\"MYDOMAIN\")\r\n\r\n    If MA.Connectors.Count = 0 Then\r\n\r\n      rdn = \"CN=\" &amp; mventry(\"cn\").StringValue\r\n\r\n      dn = MA.EscapeDNComponent(rdn).Concat(\"OU=DDLs,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=mydomain,dc=local\")\r\n\r\n      mailNickname = mventry(\"mailNickname\").StringValue\r\n\r\n      csentry = MA.Connectors.StartNewConnector(\"msExchDynamicDistributionList\")\r\n\r\n      csentry.DN = dn\r\n\r\n      csentry(\"displayName\").Value = mventry(\"cn\").StringValue\r\n\r\n      csentry(\"mailNickname\").Value = mailNickname\r\n\r\n      'The following filter selects users whose department equals the DDL cn\r\n\r\n      csentry(\"msExchDynamicDLFilter\").Value = \"(&amp;(!cn=SystemMailbox{*})\" _\r\n\r\n         &amp; \"(&amp;(&amp;(&amp;(&amp; (mailnickname=*)\" _ \r\n\r\n         &amp; \"(| (&amp;(objectCategory=person)(objectClass=user)\" _\r\n\r\n         &amp; \"(|(homeMDB=*)(msExchHomeServerName=*))) )))\" _\r\n\r\n         &amp; \"(objectCategory=user)(department=\" _\r\n\r\n         &amp; mventry(\"cn\").StringValue &amp; \"))))\"\r\n\r\n      csentry(\"msExchDynamicDLBaseDN\").Value = \"OU=Groups,OU=MyOrg, \" _\r\n\r\n                                            &amp; \"dc=mydomain,dc=local\"\r\n\r\n      csentry.CommitNewConnector()\r\n\r\n    End If\r\n\r\n  End Select\r\n\r\nEnd Sub<\/pre>\n<p>\u00c2\u00a0<\/p>\n<h2 style=\"color: #365f91;\">ILM Forum Threads<\/h2>\n<ul>\n<li><a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en-US\/identitylifecyclemanager\/thread\/be387815-89ef-40cc-b063-91c9a5cb0e69\/\">Provisioning Exchange 2007 with ILM 2007<\/a><\/li>\n<li><a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en-US\/identitylifecyclemanager\/thread\/dd7f2cfe-6bd2-4d99-b933-5356a5576e15\/\">ILM With FP1 and Exchange 2007<\/a><\/li>\n<li><a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en-CA\/identitylifecyclemanager\/thread\/8c172bab-042f-45b7-ba73-14a8a27b9f0c\">Exchange 2007 &#8216;Shared&#8217; Mailbox Provisioning with ExchangeUtils<\/a><\/li>\n<li><a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en-US\/identitylifecyclemanager\/thread\/20485235-cd87-4550-a912-d6340bd8f8a0\/\">Attribute List for Exchnage 2003<\/a><\/li>\n<\/ul>\n<p>\u00c2\u00a0<\/p>\n<h2 style=\"color: #365f91;\">About the Author<\/h2>\n<p>Carol Wapshere has been working in IT since 1990, and has since worked in many different organizations, across four different countries. She started out in Netware then moved into Microsoft server products, picking up an assortment of skills in other non-Microsoft systems along the way. She first started working with MIIS in 2005 and loved how it could be used to tie together disparate systems, bringing in much-needed order, and making lots of tedious jobs just disappear.<\/p>\n<p>Thanks to Markus Vilcinskas and Peter Geelan for their help with this document.<\/p>\n<hr class=\"sig\" \/>\nhttps:\/\/www.wapshere.com\/missmiis<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have just posted\u00c2\u00a0this article in the Greatest Hits series on the ILM Technet forum. http:\/\/social.technet.microsoft.com\/Forums\/en-US\/identitylifecyclemanager\/thread\/f8ad045d-7252-4cd1-a189-d704a8f99129 The article covers various management tasks you can acheive with the standard AD MA, including provisioning and updating of users, mailboxes, contacts and distribution groups. There are quite a few code samples as well.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[27,26,34],"tags":[],"class_list":["post-579","post","type-post","status-publish","format-standard","hentry","category-exchange2003","category-exchange2007","category-ilm2007"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-9l","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=579"}],"version-history":[{"count":6,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/579\/revisions"}],"predecessor-version":[{"id":666,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/579\/revisions\/666"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}