Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ADSI - auto creation of virtual directory using ASP&VBScript

Posted on 2000-03-15
2
Medium Priority
?
540 Views
Last Modified: 2012-06-27
Hi,
I'm trying to automatically generate virtual directories using ADSI. However, when I try to run the script I've written, I get an error (error '80005004')  at the line
Set vDir = vRoot.Create("IIsWebVirtualDir",sVirDir)

where -sVirDir is the name of the virtual dir. to be created, i.e."Test".
          -vRoot is defined as:
           set vRoot = websvc.GetObject("IIsWebVirtualDir", "ROOT") .

I'm running the script on NT Workstation - can virtual directories only be created on NT Server? If not, can you tell what's wrong with my code?
I'm a little concerned about the permissions needed to actually run this script; for the virtual directory from which this script is run (in Internet Service Manager), they are set as NT Challenge/Response. Should anonymous authentication be enabled too (note, I've tried this too and I still get the same error!)?

Thanks a lot
Clo


********Here's the whole script***************
<html>
<body>
<%

sComputer ="localhost"
sPhyDir = "d:\inetpub"
sVirDir = "Test"

'Get Default Web Site Object
set websvc = GetObject("IIS://" & sComputer & "/W3svc/1")

'Verify by printing out ServerComment
'Response.Write "Comment = " & websvc.ServerComment & "<br>"

'Get root of Default Web Site
set vRoot = websvc.GetObject("IIsWebVirtualDir", "ROOT")

'Get Class Definition of virtual directory
Set ClassDefinition = GetObject(vRoot.Schema)

'Create Virtual Directory
Set vDir = vRoot.Create("IIsWebVirtualDir",sVirDir)

'Only setting two properties
vDir.AccessRead = true
vDir.Path = sPhyDir

'Write information back to Metabase
vDir.SetInfo
%>
</body>
</html>
0
Comment
Question by:clodaghm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
cfurlin earned 150 total points
ID: 2620830
Uncheck "Allow Anonymous Access" for the server you are running this code on.

This works if you are receiving the "Permission Denied.GetObject" message, and judging from your code above, that probably whats occurring.

Hope this was helpful.

Christopher Furlin
0
 
LVL 2

Expert Comment

by:DKostov
ID: 2620835
Hi,
Your code seems to be ok. You can take a look on one of my previous answers
http://www.experts-exchange.com/jsp/qShow.jsp?ta=winprog&qid=10179526 
I dont think that the NT Workstation is a problem. The most probable thing from my point of view are the permissions.
Also, you are sure that "vRoot" is a valid object? You are sure that you have not already created "Test" vDirectory?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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