VBScript working but vbscript in asp not! GetObject("WinNT:")

Posted on 2005-05-17
Last Modified: 2008-03-04
Hey I'm writing a simple VBscript to add a user to my active directory. The strange thing is that it works as a vbscript which I run as administrator but when I paste the code into a asp page and run it off the web browser I get some error
saying activeX component can't create object erroring on the line that says computer = GetObject("WinNT:blabla")

here's my script

<script language=vbscript>
 AddUser  "newuser","itchdustry.local"
  Sub AddUser(strUser,strDomain)
     Dim Computer
     Dim User

     Set Computer = Getobject("WinNT://" & strDomain)
     Set User = computer.create("User",strUser)

   Set User = nothing
   Set computer = nothing
 End sub


I guess it is something with permissions, but what do I have to set where to get this working from a ASP page??
eventually i want to use this to add exchange mailboxes from my website. (nooo im not creating a hotmail like service lol)

500 points for the one who can solve this :) :) :)

Oh. PS.

Im running windows server 2003 with IIS6 and service pack1
Question by:ro8inmorgan
    LVL 8

    Expert Comment

    Well, the problem i think is the following:
    Your website by default runs under the restricted IUSR account, and that account has insufficient rights.

    You can change the user your site runs under by right clicking it in IIS, selecting properties, navigating to the "directory security" tab and then clicking the edit button under "anonymous access and authentication control" (typing this from an xp box so details may be a little different).
    Set the site to run under an account with more rights

    Author Comment

    Nope I changed that to Administrator even and didn't make a difference I even tried running the World Wide Web service with a different account which only resulted in not starting the service.

    I made my anonymous account for the whole site Administrator and still nothing :( what can it be?

    this is the url im running the script off
    LVL 8

    Expert Comment

    It's asking me for a password, have you disabled anonymous access?

    Author Comment

    yeah sorry was testing
    no its not if im right
    LVL 8

    Accepted Solution

    ow I got it :)

    you are using client side vbscript instead of server side.

    If I get your page and do a view source, the code is right there.
    You should use <script language="vbscript" runat="server"> to make it serverside.

    Then see if you get any error messages.

    Author Comment

    OOow noo i can just shoot myself now!!  lol

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now