header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Looking for Interop.CDOEXM.dll to create mail enabled contacts
Last Post 19 May 2010 04:49 AM by wpb. 9 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
GregUser is Offline
New Member
New Member
Posts:38
Avatar

--
09 Jan 2009 07:49 PM
    I found a script to allow me to create mail enabled contacts in Windows 2003, but it references Interop.CDOEXM.dll and I cannot find the file to download. Does anyone know where I can find it? I would also be open to finding another script to allow me to select a large group of AD users and create mail enabled contacts for each. The real goal of what I am trying to do is we are moving some users off of our Exchange 2003 server and onto an outsourced mail server. We are going to keep their current email accounts for another 6 months, so we need to make sure that any email that comes to their current accounts gets forwarded to their new email account. I am looking to create mail enabled contacts for each and set their current AD account to forward to their contact. Thanks for any help.
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    10 Jan 2009 08:48 AM
    If you have exchange admin tools installed then the you can find cdoexm.dll in C:\Program Files\Exchsrvr\bin.
    I would get AD with Get-QADUser and create new contact for each using 'New-QADObject -Type contact...'


    This is a rough example, it creates a new contact object foreach user with a name prefixed with "FW_" in the same location as the user object, redirect the mail to that object and sets the 'deliver messages to both forwarding address and mailbox' aduc option ( there may be more contact attributes you need to populate but you can start with the below).

    Another option would be to get the users from a csv file that has a pre populated new email address column (e.g FwdEmailAddress) which you can use to set the forwarding address (e.g {mail=$_.FwdEmailAddress} ):



    $deliverAndRedirect=$true

    Get-QADUser | foreach {
    $contact=New-QADObject -Type contact -ParentContainer $_.ParentContainerDN -name ("FW_"+$_.DisplayName) -oa @{mail=}
    $_ | Set-QADUser -oa @{deliverAndRedirect=$deliverAndRedirect; altRecipient=$contact.dn }
    }


    HTH

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    GregUser is Offline
    New Member
    New Member
    Posts:38
    Avatar

    --
    10 Jan 2009 07:18 PM

    Shay,

    I tried the script and got the following message:

    Missing statement after '=' in hash literal.
    At line:2 char:116
    + $contact=New-QADObject -Type contact -ParentContainer $_.ParentContainerDN -name ("FW_"+$_.DisplayName) -oa @{mail=}
    <<<<

    Also, I have Exchange Admin Tools, but all I have is cdoexm.dll. What is Interop.CDOEXM.dll? It can't seem to find it in C:\Program Files\Exchsrvr\bin.

    Any thoughts? Thanks.

    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    10 Jan 2009 10:45 PM
    You need to populate the each contact's new mail address (either from csv or manually):

    -oa @{mail="user@domain.com"}

    As to 'Interop.CDOEXM.dll', maybe this?

    http://www.nodevice.com/dll/Interop...20360.html

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    GregUser is Offline
    New Member
    New Member
    Posts:38
    Avatar

    --
    11 Jan 2009 09:02 AM
    Shay,

    I tried that site to download the file, but it gives me a 404 error, so I guess I will need to give that one up. As far as putting an email address in on your code, I want to use the user's username folowed by a domain. What I am doing is going through our AD and selecting a certain group of people. For eample: Let's say I am qualifying the for each to pick up 2 users (John Adams and Kyle Johnson). Currently their usernames are jadams and kjohnson. Their email addresses are jadams@currentdomain.com and kjohnson@currentdomain.com. I want to move all users to a hotmail account, so the @hotmail.com will be consistent for all users. so as I am creating a contact for these 2 users I want to mail-eable them so that their email to the currentdomain.com get forwaded to their hotmai.com account. Can I use variables after -oa @{mail= so that it includes the user's username followed by @hotmail.com?

    Thanks for the help. I am brand new to PowerShell so I am really learning the babasics and it seems that everyone does things differently.
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    11 Jan 2009 11:22 AM
    This will get all 'users' ou users and create a mail enabled contact foreach one of them, then it sets each contact as the user's forwarding address:


    $deliverAndRedirect=$true

    Get-QADUser -sizeLimit 0 -ldap "(mailnickname=*)" -ou 'CN=Users,DC=domain,DC=com'| foreach {
       $contact = New-QADObject -Type contact -ParentContainer $_.ParentContainerDN -name ("FW_"+$_.DisplayName)
       $contact | Set-QADObject -oa @{displayName=$_.displayName;samAccountName=$_.samAccountName; mailNickName=$_.mailNickName;mail=($_.samAccountName+"@hotmail.com")}
       $_ | Set-QADUser -oa @{deliverAndRedirect=$deliverAndRedirect; altRecipient=$contact.dn }
    }


    You should see similar output to:

    Name Type
    ---- ----
    FW_UserB contact
    UserB user
    FW_testB contact
    testB user


    It shows the new created contacts and modified user accounts, to supress the out pipe the last two lines to out-null.



    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    GregUser is Offline
    New Member
    New Member
    Posts:38
    Avatar

    --
    11 Jan 2009 01:54 PM
    Shay,

    Thanks! That is looking good. Hopefully one last question. I want to have the value in the global address list to show just last name, first name. Also, can I do this so that the Name in AD shows up as their username, can it be stored in a specific OU and can I set the AD description for the user as the description in the contact?

    Thanks for your help. This is great stuff!
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    13 Jan 2009 12:58 PM
    You can set the contacts name as the user name in a seprate ou, just remove the FW_ prefix and set the -ParentContainer value to the OU you want them to be in.

    Add the '-Description $_.description' to the new-qadobject call to set the contact description the same as the user's.

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    GregUser is Offline
    New Member
    New Member
    Posts:38
    Avatar

    --
    13 Jan 2009 04:51 PM
    Thanks Shay!
    wpbUser is Offline
    New Member
    New Member
    Posts:3
    Avatar

    --
    19 May 2010 04:49 AM
    to get the Interop.CDOEXM.dll one must follow this instructions

    Install Microsoft Windows SDK (if not previously installed)
    Open the SDK Cmd Shell

    tlbimp \msado15.dll /out:\interop.adodb15.dll /sysarray
    tlbimp \msado25.tlb /out:\interop.adodb25.dll /sysarray

    tlbimp  cdoexm.dll /reference:interop.adodb15.dll
     /reference:interop.adodb25.dll /out:interop.CDOexm.dll

    Result:
    Type library imported to interop.CDOexm.dll





    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer