Creating web applications NOT via IIS console

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top