Just looking for the relevant documentation. An example is not necessary, but would be appreciated.
We have a situation where we are having to create 100s of virtual directories manually, and it seems like automating this would be a good way to make the process more efficient for now.
Perhaps next year we can rework the server environment to allow something more sane, such as URL rewriting (unfortunately this does not seem feasible in the current cycle of the web application). Isn't it great to inherit crap code?
~ William Riley-Land
It is easier to do it with vbscript too..
' This code creates a virtual directory in the default Web Site
' ---------------------------------------------------------------
' From the book "Windows Server Cookbook" by Robbie Allen
' ISBN: 0-596-00633-0
' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------
strComputer = "rallen-w2k3"
strVdirName = "<VdirName>" 'e.g. employees
strVdirPath = "<Path>" 'e.g. D:\resumes
' ------ END CONFIGURATION ---------
set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/1")
set objWebSite = objIIS.GetObject("IISWebVirtualDir","Root")
set objVdir = objWebSite.Create("IISWebVirtualDir",strVdirName)
objVdir.AccessRead = True
objVdir.Path = strVdirPath
objVdir.SetInfo
WScript.Echo "Successfully created virtual directory: " & objVdir.Name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With