Hi All,
I have some vbscript code I use to set paths to virtual directories when a developer switches his/her environment to work on another project. Currently, we try to set the path, and if there's an error, we create it. It just smells funny. Is there a way to check if a Virtual Directory exists? And if not, create it?
set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/1/ROOT/SomeWeb")
objIIS.Path = strNewPath & "\SomeWeb"
objIIS.SetInfo
If Err.Number = NOT_FOUND Then
sVirtPath = strNewPath & "\SomeWeb"
CreateVirtualDirectory "SomeWeb", sVirtPath, true
Err.Clear
End If
This works just fine, but something tells me, there must be a better way. Does anyone have any suggestions? How do I check for the existence of a Virtual Directory? Any feedback is appreciated.
Thanks for any pointers.
Cheers,
~ck in San Diego