Solved

ADSI - auto creation of virtual directory using ASP&VBScript

Posted on 2000-03-15
2
527 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
2 Comments
 

Accepted Solution

by:
cfurlin earned 75 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

816 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

13 Experts available now in Live!

Get 1:1 Help Now