Re: hta front end for script?

From: McKirahan (
Date: 05/11/04

Date: Tue, 11 May 2004 13:03:12 GMT

"Richard Rekos" <> wrote in message
> I cannot figure out how to setup a form on a hta page so I can input the
value for "cn" and "ou" (4th line on script below). I am trying to have
this script add a user to a security group in AD. I don't want to have to
go into the code and enter the cn and ou values, I would like to use a form
in a hta page. Can anyone help w/ this? Many thanks.
> Set objGroup = GetObject _
> ("LDAP://cn=testing,ou=qm,dc=xyz,dc=com")
> "member", Array("cn=rich,ou=test,ou=qm,dc=xyz,dc=com")
> objGroup.SetInfo

Richard, just adapt what I gave you before for "Front End input for

Watch for word-wrap:

<hta:Application ID="hta"
<script type="text/vbscript">
Function Account()
    Dim strCN
        strCN = document.form1.CN.value
    Dim strOU
      strOU = document.form1.OU.value
    Dim objGroup
'* the following needs some tweaking ...
    Set objGroup = GetObject("LDAP://cn=testing,ou=qm,dc=xyz,dc=com")
        objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array"cn=" & strCN &
",ou=" & strOU & ",ou=qm,dc=xyz,dc=com")
    Set objGroup = Nothing
End Function
<form name="form1">
<br><b>CN :</b> &nbsp; <input type="text" name="CN"> &nbsp;
<br><b>OU :</b> &nbsp; <input type="text" name="OU"> &nbsp;
<br><input type="button" value="Create Account" onclick="Account()">

Save as "Account.hta" the double-click on it in Windows Explorer.

I'm not familiar with ".PutEx" so I don't understand why "ou=" and "dc="
appear twice and thus my "solution" doesn't correctly do what you want...