• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 983
  • Last Modified:

Creating Virtual Directories by script or XML file

I need to create a large number of virtual directories and am looking for a way of either automating or speeding up the process. The virtual directories have a more complex config including a username and password to allow access to a share and setting permission on it. Consequently Iisvdir.vbs that ships with windows does not fit the bill as it leaves a number of tasks undone. I notice that it is possible to create virtual directories from an XML file so my question is can anyone either:-

Point me to a script that would give me total control of the creation process.

Or

If the XML control file would fit the bill, point me in the direction of how to create such a file.
0
cescentman
Asked:
cescentman
  • 5
  • 5
1 Solution
 
meverestCommented:
Hi,

take a look at [installdrive]:/inetpub/adminscripts/adsutil.vbs

just run "cscript.exe \inetpub\adminscripts\adsutil.vbs" as a cmd shell for usage - there is an example for creating virtual directory in the usage info.

Cheers.
0
 
RubalJCommented:
0
 
cescentmanAuthor Commented:
Thanks both for the suggestions. There is a wealth of information here but I can't see any details on how I add the username and password via the scripts.
0
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.

 
cescentmanAuthor Commented:
Should I abandon this or does anyone have any suggestions?
0
 
meverestCommented:
Hi,

to set access credentials on any path, you need to set credentials via ntfs permissions on the physical location/s.  Once you have done that, simply disable anonymous access to the virtual dir, and then that path will require login.

If you want to also script the credentials, then you will either need something to work with ntfs permissions, or else use some kind of ISAPI-auth, something like this one:

http://www.codeproject.com/KB/ISAPI/authfilter.aspx

cheers.
0
 
cescentmanAuthor Commented:
Thanks for the suggestion but this doesn't really bear on the issue, NTFS permissions are already set. When setting up the virtual directory I need to set a user name and password for the user that has access to the particular share. In addition to that I also need to set the permisiins on the IIS virtual folder object.

0
 
meverestCommented:
Are you referring to anonymous web user?

That is done using "AnonymousUserName" and "AnonymousUserPass" parameters to adsutil.vbs, e.g:

e.g. create the virtual dir:

c:\inetpub\adsutil.vbs CREATE W3SVC/1/Root/MyVdir "IIsWebVirtualDir"

set the path:

c:\inetpub\adsutil.vbs SET W3SVC/1/Root/MyVdir/Path "C:\path\path"

Set the anonymous credentials:

c:\inetpub\adsutil.vbs SET W3SVC/1/Root/MyVdir/Path/AnonymousUsername "someuser"
c:\inetpub\adsutil.vbs SET W3SVC/1/Root/MyVdir/Path/AnonymousUsername "somepassword"

Cheers.
0
 
cescentmanAuthor Commented:
Maybe that's what has confused me. In the IIS snapin under virtual directory there is the "Connect As..." button is that the same as the "AnonymousUsername" ?
0
 
meverestCommented:
OH!  You are talking about virtual dirs on a remote share!

No, not Anonymous Username, that one is "UNCUserName" and "UNCPassword", i.e:
c:\inetpub\adsutil.vbs CREATE W3SVC/1/Root/MyVdir "IIsWebVirtualDir"

set the UNC path:

c:\inetpub\adsutil.vbs SET W3SVC/1/Root/MyVdir/Path "\\server\share\path"

Set the anonymous credentials:

c:\inetpub\adsutil.vbs SET W3SVC/1/Root/MyVdir/Path/UNCUsername "someuser"
c:\inetpub\adsutil.vbs SET W3SVC/1/Root/MyVdir/Path/UNCPassword "somepassword"

by the way, you can inspect any IIS6 settings by using adsutil ENUM and GET commands, then use CREATE and SET to reproduce.

Cheers.
0
 
cescentmanAuthor Commented:
OK thanks I'll give it a try.
0
 
meverestCommented:
if you are going to give a B grade, then at least you should give a reason.

cheers.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now