Over the past year, I've been discussing how to automate Exchange Server creation and deletion tasks. In the articles "Script User Account and Mailbox Creation," September 2002,, InstantDoc ID 25843, and "Deleting User Accounts and Exchange 2000 Mailboxes," June 2003, InstantDoc ID 38529, I explain how to perform creation and deletion tasks in an Exchange 2000 Server environment. In the article "Automatically Create User Accounts and Mailboxes in Exchange 5.5," August 2003, InstantDoc ID 39177, I explain how to automate the process of creating Exchange Server 5.5 email-enabled user accounts. This article completes this discussion by explaining how to automate the process of deleting Exchange 5.5 mailboxes and Windows NT or Active Directory (AD) user accounts.

The scripting solution that I provide is called the RUM55 utility. RUM is short for Remove User and Mailbox; 55 designates that this solution is designed to delete mailboxes in an Exchange 5.5 directory only. RUM55 requires Active Directory Service Interfaces (ADSI) and Windows Script Host (WSH) 5.6, along with VBScript and XML, to make automating user account and Exchange 5.5 mailbox deletion an obtainable goal. I do my best to follow the outline of the "Deleting User Accounts and Exchange 2000 Mailboxes" article. My hope is that if you read the previous articles on this subject, you'll find this article even easier to follow.

The Prerequisites
You need to meet fewer prerequisites for automating the deletion of user accounts and mailboxes in Exchange 5.5 than for creating those user accounts and mailboxes. Fewer prerequisites exist not because the deletion task is easier to implement programmatically than the creation task, but rather because I choose to use ADSI exclusively to perform the deletion task. To perform the creation task, I used a COM object (AcctMgmt) that wasn't installed and registered by default. Because I'm using ADSI exclusively for the deletion task, you won't need to install or register any COM objects to use the RUM55 utility. However, you still must meet these prerequisites:

  • Your network must run Exchange 5.5 with accounts in an AD or NT domain.
  • You must be logged on to the domain that contains the user account you want to delete.
  • You must have the necessary permissions to delete user accounts and mailboxes.
  • The client computer on which you intend to run RUM55 must have WSH 5.6 installed. You need WSH 5.6 because RUM55 uses an improved method of managing command-line arguments and an XML file format, both of which I describe in "Automatically Create User Accounts and Mailboxes in Exchange 5.5."
  • The client computer must have ADSI installed. ADSI is preinstalled on computers running Windows 2000 or later. If you plan to run the script from NT or Windows 9x, you must install the Active Directory Client Extensions. For more information about these extensions, including where to obtain them, see the Microsoft article "Active Directory Client Extensions for Windows 95/98 and Windows NT 4.0" (

Running the Script
RUM55 consists of two scripts: RUM55.wsf and RUM55Code.vbs. The scripts are in, which you can download from the Code Library (, InstantDoc ID 39508). RUM55.wsf is a Windows Script file whose contents I've structured as XML code. (I explain why I use the XML format in "Automatically Create User Accounts and Mailboxes in Exchange 5.5.") RUM55Code.vbs is a VBScript file that contains code on which RUM55.wsf relies.

When RUM55.wsf runs, it calls RUM55Code.vbs. You can run RUM55.wsf from WSH's graphical interface (wscript.exe) or command-line interface (cscript.exe). For command-line help with RUM55.wsf, type




and press Enter. When you run RUM55.wsf from wscript.exe, the script displays Help and status information in a message box, as Figure 1 shows. When you run RUM55.wsf from cscript.exe, the script displays the same information in a command window. If you want to know why two script hosts exist, which is the default script host, and how to change that default, see "Automatically Create User Accounts and Mailboxes in Exchange 5.5."

As Figure 1 shows, the RUM55 utility requires three parameters (i.e., /a, /u, and /ru) to delete an NT user account and four parameters (i.e., /a, /u, /c, and /ru) to delete an AD user account. Figure 1 describes the values you specify for each parameter. Note that for AD user account deletion, the /c parameter must be the distinguished name (DN) of the container that hosts the user account. You can specify either a default AD container (e.g., cn=Users) or an organizational unit (OU—e.g., ou=Management).

If you omit a mandatory parameter, RUM55.wsf displays the information that appears in Figure 1. The parameters and their values aren't case sensitive, and the parameter order isn't important. If any of the parameter values contain spaces, you must enclose the value in quotation marks. For example, if you want to delete just the AD user account named EthanW in an OU named Tech Writers, you'd type

rum55 /a:ad /ru-
   /c:ou="Tech Writers"

on one command line and press Enter. To delete both the mailbox and the user account, you'd change /ru- to /ru+.

As you can see, using the RUM55 utility is easy. Now let's look at how RUM55.wsf and RUM55Code.vbs work together to delete Exchange 5.5 mailboxes and AD or NT user accounts.

RUM55.wsf Step-by-Step
A .wsf file provides additional features that aren't available in .vbs or .js files. One such feature is XML elements that you can use. For example, you can use the element to document a script's usage information. For more information about the XML elements, see "Automatically Create User Accounts and Mailboxes in Exchange 5.5."

RUM55.wsf includes the

Sponsored Introduction Continue on to (or wait seconds) ×