Create new user using IIS/ASP

Discussion in 'ASP General' started by Ohaya, Nov 14, 2003.

  1. Ohaya

    Ohaya Guest

    Hi,

    I'm running IIS5 on a Win2K server, and I want to have an ASP page that
    creates new users. I have some simple code to test this, but am getting
    a "500" error when I run it.

    The ASP looks like:

    <%

    strDomain ="Foo.com"
    strUser ="Foo1"

    ' Create new user with password
    Set oDomain = GetObject("WinNT://" & strDomain)
    Set oUser = oDomain.Create ("User", strUser)
    oUser.SetPassword = "password"
    oUser.SetInfo
    %>

    Just for this testing, I've added IUSR_machinename to the Administrators
    group, but am still getting the 500 error.

    Can anyone tell me what I'm doing wrong here???

    Thanks in advance!!
     
    Ohaya, Nov 14, 2003
    #1
    1. Advertising

  2. Ohaya

    Ray at Guest

    Try using:

    oUser.SetPassword "password"

    ..SetPassword is a method that requires an argument. You're trying to treat
    it as a property. That's my interpretation, anyway!

    Also, http://www.aspfaq.com/2109

    Ray at work

    "Ohaya" <ohaya@NO_SPAM.cox.net> wrote in message
    news:3FB51ABA.29565DFA@NO_SPAM.cox.net...
    > Hi,
    >
    > I'm running IIS5 on a Win2K server, and I want to have an ASP page that
    > creates new users. I have some simple code to test this, but am getting
    > a "500" error when I run it.
    >
    > The ASP looks like:
    >
    > <%
    >
    > strDomain ="Foo.com"
    > strUser ="Foo1"
    >
    > ' Create new user with password
    > Set oDomain = GetObject("WinNT://" & strDomain)
    > Set oUser = oDomain.Create ("User", strUser)
    > oUser.SetPassword = "password"
    > oUser.SetInfo
    > %>
    >
    > Just for this testing, I've added IUSR_machinename to the Administrators
    > group, but am still getting the 500 error.
    >
    > Can anyone tell me what I'm doing wrong here???
    >
    > Thanks in advance!!
     
    Ray at, Nov 14, 2003
    #2
    1. Advertising

  3. Ohaya

    Ohaya Guest

    Ray,

    HOORAY!!!! That worked great!!

    Thanks a lot!

    (Did I include enough exclamation points in this post :)?)

    Jim



    "Ray at <%=sLocation%>" wrote:
    >
    > Try using:
    >
    > oUser.SetPassword "password"
    >
    > .SetPassword is a method that requires an argument. You're trying to treat
    > it as a property. That's my interpretation, anyway!
    >
    > Also, http://www.aspfaq.com/2109
    >
    > Ray at work
    >
    > "Ohaya" <ohaya@NO_SPAM.cox.net> wrote in message
    > news:3FB51ABA.29565DFA@NO_SPAM.cox.net...
    > > Hi,
    > >
    > > I'm running IIS5 on a Win2K server, and I want to have an ASP page that
    > > creates new users. I have some simple code to test this, but am getting
    > > a "500" error when I run it.
    > >
    > > The ASP looks like:
    > >
    > > <%
    > >
    > > strDomain ="Foo.com"
    > > strUser ="Foo1"
    > >
    > > ' Create new user with password
    > > Set oDomain = GetObject("WinNT://" & strDomain)
    > > Set oUser = oDomain.Create ("User", strUser)
    > > oUser.SetPassword = "password"
    > > oUser.SetInfo
    > > %>
    > >
    > > Just for this testing, I've added IUSR_machinename to the Administrators
    > > group, but am still getting the 500 error.
    > >
    > > Can anyone tell me what I'm doing wrong here???
    > >
    > > Thanks in advance!!
     
    Ohaya, Nov 14, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lewi
    Replies:
    0
    Views:
    381
  2. Brad Rogers
    Replies:
    5
    Views:
    424
    Brad Rogers
    Dec 25, 2005
  3. Jon Davis
    Replies:
    3
    Views:
    624
    Jon Davis
    Jun 21, 2007
  4. prady
    Replies:
    2
    Views:
    449
    Phil H
    Dec 29, 2007
  5. Guennadi V. Vanine
    Replies:
    0
    Views:
    167
    Guennadi V. Vanine
    Aug 21, 2003
Loading...

Share This Page