October 25, 2016
Hot Topics:

Enterprise Powershell: Creating Mailboxes in Exchange 2003

  • July 23, 2007
  • By Jon Shoberg and Eddie Willett
  • Send Email »
  • More Articles »

Finally, you loop though the query results and invoke CDOEXM's createmailbox on each user, printing an error or success result, and dispose of allocated resources. When invoking createmailbox, you'll notice that one of the usage of .PSBase; this is important because it allows you to access the underlying .NET ADSI native object.


foreach($person in $people)
   $mailstore = $EXCHANGE_MAILSTORE
   [string]$dn = $person.properties.distinguishedname
      New-Object System.DirectoryServices.DirectoryEntry

   #create the mailbox


   if($domain_person.homeMDB -ne $null)
      #force AD user update

      #print the success
      Write-Host "Success: $dn"
      #print the failure
      Write-Host "Error: $dn"
   #close connections
   $domain_person.dispose | out-null


$domain_query.dispose | out-null

The following figure shows output of the script.

Click here for a larger image.


Now that you have seen how it's possible to create user mailboxes with Powershell, the door is now wide open to use CDOEXM to manage other facets of your Exchange 2003 servers such as deleting and moving mailboxes. As a developer or administrator who is gearing towards a migration from Exchange 2003 to Exchange 2007, this is a prime opportunity to get your hands on Powershell today and make your future development work much more productive and efficient. If you build further on what you've learned here, please let us know by emailing jonATshoberg.net.

About the Authors

Jon Shoberg is a senior developer for the Fisher College of Business at The Ohio State University. He has extensive experience in developing enterprise systems in e-commerce, web, and search domains on the LAMP, Java, and .NET platforms. Jon has previously contributed to books and industry publications as a technical reviewer and coauthor, respectively.

Eddie Willett is an independent consultant specializing in Microsoft technologies. Powershell has become a recent favorite of his and would love to hear your feedback: eddieATshoberg.net.

Page 2 of 2

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel