Solved

ADSI - auto creation of virtual directory using ASP&VBScript

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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 informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 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