Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


January 22, 2004

Exchange Scripting Revisited


RSS
Subscribe to Windows IT Pro | See More Scripting Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

A few months ago, I mentioned some cool scripting tricks for Exchange Server and Windows and promised to revisit the topic. I've been digging further into Exchange scripting in preparation for a new book, and I was a little surprised to learn how many scripting interfaces--each with its own focus and sphere of usefulness--actually exist for Exchange.

The original Collaboration Data Objects (CDO) library was written so that programs could create and manipulate calendar items, mail messages, and contacts in the Exchange store. CDO had its heyday when Windows 98 was new; since then, newer libraries have superseded the original one.

The CDO for Windows 2000 (CDOSYS) library shipped with Windows 2000 and lives on in Windows Server 2003 and Windows XP. This DLL lets you quickly and easily build properly structured MIME and HTML messages--a valuable ability when you write scripts or programs that need to send email.

The CDO for Exchange (CDOEX) libraries (in Exchange Server 5.5 and later) let systems create and modify Exchange objects in the Store. These DLLs are a bit like CDO, only newer.

The CDO for Exchange Management (CDOEXM) library is my current favorite. CDOEXM lets you manage Exchange system objects, including storage groups (SGs) and mailbox databases. Want to create a new mailbox database from a script or move transaction logs to another disk? CDOEXM can perform these tasks and a lot more besides. You can use the ADO interfaces to make databaselike queries against Exchange and Active Directory (AD) data. For example, you can use ADO to find all matching messages in a mailbox after you log on to it. Because several Microsoft interfaces and programs use ADO, most Windows programmers understand it pretty well. The Active Directory Service Interfaces (ADSI) gives you a way to perform required AD actions. You can connect to domain controllers (DCs), locate and manipulate properties of AD objects (ranging from computers and user accounts to organizational units--OUs--and domains), and trigger several system processes.

XML-HTTP scripting isn't a defined interface per se but rather refers to the process of using the WWW Distributed Authoring and Versioning (WebDAV) interface to query or set properties on items in the Exchange Store directly. Not many tools use XML-HTTP, but it provides the greatest degree of control over individual properties of mailbox and public folder items.

These interfaces can be, and usually are, combined. For example, a script to create a new mailbox-enabled user will probably use ADSI and ADO and might use CDOEX to create a welcome message for the user. All these interfaces are well documented on Microsoft Developer Network (MSDN), and many of them feature prominently in Exchange-related Microsoft Knowledge Base articles.

In the coming months, I'll be writing a lot of scripts, and I'll share the most interesting ones with you here. Until then, why not check into these scripting interfaces and see how you can put them to good use? If you've already written some Exchange-related scripts, I'd love to hear about them, too.

End of Article



Reader Comments
I've written a script to dump the contents of each mailbox in the Global Address List to a web page. I have another script that creates the index for the generated pages.

The scripts run nightly in case there have been changes, such as new mailboxes added. I used JScript as the scripting language and ADO and ADSI to access Exchange 5.5.

I created web page templates so I didn't need to hard code the HTML in my script. The script reads in the template at the beginning. It creates an ADO recordset by querying Exchange, using ADSI.

The script spins through the recordset and writes one HTML page for each record. The HTML page is created by replacing the placeholders in the template with fields in the recordset. It uses regular expressions to do this.

The index page is generated in a similar manner. The ADO recordset is handy, because you can sort the data easily before you create the index page.

The script gets its configuration settings from an XML file, so it can be changed easily without needing to modify the code.

Jason Price January 27, 2004


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
CES 2009: Ballmer Announces Windows 7, Windows Live, Live Search Milestones

During his first-ever Consumer Electronics Show (CES) 2009 keynote address last night in Las Vegas, Microsoft CEO Steve Ballmer announced the pending public availability of a feature-complete Windows 7, the final version of Windows Live Essentials, and ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Where is Microsoft NetMeeting in Windows XP?

...


Exchange Server and Outlook Whitepapers Protecting (You and) Your Data with Exchange Server 2007

StoreVault SnapManagers for Microsoft Exchange and SQL Server

Related Events Storage Consolidation for Your Microsoft Applications: Reducing Cost and Complexity

Top 10 Email Security Challenges and Solutions

Introduction to Identity Lifecycle Manager "2"

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing