Provisioning Hosted Exchange Users from a Web Page
Originally published July 22, 2005
I wrote last year, in this article, about using a script to provision a hosted Exchange user, and that works well.
Well, I should say, it works well for me. The other folks in the office who have to provision Exchange users, and whose mind doesn't work quite the same way mine does, think that it was unfriendly and difficult to use (they generally stop saying that when I show them how to do it all manually! -- but they still complain).
So, finally, I've put it into a web page. I did this for several reasons: complaints from these folks, the book I'm writing (I needed to proceduralize lots of stuff), and because of a permissions question that arose from readers of the original blog article.
To cut to the chase, you can download the code from: http://www.TheEssentialExchange.com/blogs/michael/Web-provision-2005-07-22.zip.
Using event scripts let me do things like this to modify a form-element:
<input name="lastname" maxlength=25 size=25>
<script event="onblur" for="lastname" language="vbscript">
Dim strLast, strFirst, str, strPass, strChar
Dim i, j
' build a suggestion for the account name
strLast = Trim (document.buildexch.lastname.value)
strFirst= Trim (document.buildexch.firstname.value)
If (Len (strFirst) > 0) And (Len (strLast) > 0) Then
str = Left (strFirst, 1) & strLast
i = Len (str)
document.buildexch.user.value = str
To solve the second problem, I used hidden form fields along with ASP to generate the content of those form fields. Therefore there are several things like this:
<INPUT TYPE=HIDDEN NAME=“stroulist“ VALUE=”domain1.com;domain2.com;domain3.com....”>
that are used to pass small data tables from the backend to the client. These are used in the client-side script in order to validate information and provide suggestions and choices to the end-user.
Neither of these solutions are rocket science, and I'm certain that experienced developers already knew all about these. They are new to me. :-)
To set this up, simply create a virtual directory off the Default Web Site on an Exchange Server (or any server where the Exchange System Management tools are installed). That particular virtual directory needs to have Anonymous access disabled, as shown in this picture:
I also recommend that you disable Basic authentication, as shown in this picture, but that is simply a preference of mine.
The user that is able to create an Exchange user must (assuming no special delegated permissions exist) be member of the Domain Admins security group (from ADUC).
The lib\constants.asp file has the items that you may need to modify to make this work in your environment. Note that the script presumes an environment, as described here. However, the code is quite general purpose, except for the dependence in a few places on OU_HOSTING.
The lib files are just code libraries, that I often reuse for multiple projects, slightly modified to work with ASP files instead of VBS or WSF files.
So, then enter http://server-name/prov/exch.asp and you should be good to go.