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

Posted on 2005-05-17
Medium Priority
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
  • 3
  • 3

Expert Comment

ID: 14017600
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

ID: 14017616
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


Expert Comment

ID: 14017633
It's asking me for a password, have you disabled anonymous access?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 14017649
yeah sorry was testing
no its not if im right

Accepted Solution

tomvergote earned 2000 total points
ID: 14017650
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

ID: 14017664
OOow noo i can just shoot myself now!!  lol

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Why WooCommerce is one of the majorly favored choices when it comes to having an eCommerce store. This article will acquaint you with some reasons that I believe make it one of the best eCommerce platforms available.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

571 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