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.
LVL 1
cescentmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.