Link to home
Start Free TrialLog in
Avatar of cescentman
cescentmanFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.
Avatar of meverest
meverest
Flag of Australia image

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.
Avatar of cescentman

ASKER

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.
Should I abandon this or does anyone have any suggestions?
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.
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.

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.
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" ?
ASKER CERTIFIED SOLUTION
Avatar of meverest
meverest
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK thanks I'll give it a try.
if you are going to give a B grade, then at least you should give a reason.

cheers.