Creating web applications NOT via IIS console

G

Guest

is there any way to promote programatically a directory
(located within inetpub directory subtree) to web application?

Also I would like programatically add new IASPI mapping
(for some custom file extension to particular DLL)
for this newly created web application.


Thanks for help
Michał Januszczyk
 
G

George

Yes.
You should use ADSI
It's easy to use from VBS.
Here is the sample i wrote for our application.
It's installing an applicatio on IIS in a vritual folder /English/club


Sub CreateIISApplication()
On Error Resume Next
Err.Clear
Dim sWorkingFolder, sWWWRoot
Set objIIS = GetObject("IIS://Localhost/W3SVC/1/Root")
sWWWRoot = objIIS.PAth

sWorkingFolder = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - 12 )
WScript.Echo "Copying ASP files.PLease wait."
Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject")
objFileSystem.CopyFolder sWorkingFolder & "\InstallFiles\IIS Files", sWWWRoot, true

objIIS.GetInfo
Set objDir = objIIS.GetObject("IIsWebDirectory", "English")
if Err.Number <> 0 Then
Err.Clear
Set objDir = objIIS.Create("IIsWebDirectory", "English")
End if
objDir.AccessScript = true
objDir.SetInfo
objDir.GetInfo

Set objDir = objDir.GetObject("IIsWebDirectory", "Club")
if( Err.Number <> 0 ) Then
Err.Clear
Set objDir = objIIS.Create("IIsWebDirectory", "Club")
End if
objDir.AppCreate true
objDir.AccessScript = true
objDir.SetInfo

Set objApp = GetObject("IIS://Localhost/W3SVC/1/Root/English/Club")
Set objDir = objApp.GetObject("IIsWebDirectory", "Admin")
if( Err.Number <> 0 ) Then
Err.Clear
Set objDir = objApp.Create("IIsWebDirectory", "Admin")
End if
objDir.ContentIndexed = False
objDir.AuthAnonymous = False
objDir.SetInfo
On Error goto 0
Set objDir = objApp.GetObject("IIsWebDirectory", "Members")
if( Err.Number <> 0 ) Then
Err.Clear
Set objDir = objApp.Create("IIsWebDirectory", "Members")
End if
objDir.ContentIndexed = False
objDir.AccessSSL = True
objDir.SetInfo

End Sub


George
My Site - Body Jewelry
is there any way to promote programatically a directory
(located within inetpub directory subtree) to web application?

Also I would like programatically add new IASPI mapping
(for some custom file extension to particular DLL)
for this newly created web application.


Thanks for help
Michał Januszczyk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top