Make folder a IIS application by script

C

chak

I wish to use 'Nant' to unzip a folder (which has a web service in it) under
the Inetpub/wwwroot folder , and make it a IIS application through a script
(maybe VBScript). So, the make file would unzip and make the folder an IIS
application .

Any tips, or pointers to any examples on the web ?
 
H

Hayato Iriumi

Hello chak,

I have created a reusable class called IISAdmin. Hope this helps.


Const IIS_PATH = "IIS://localhost/w3svc/1/root"
Class IISAdmin
Private m_IIS

Private Sub Class_Initialize
On Error Resume Next
Set m_IIS = GetObject(IIS_PATH)

If Err.Number <> 0 Then
MsgBox Err.Description, vbOKOnly + vbExclamation, APP_NAME
Err.Clear()
Exit Sub
End If
End Sub

Private Sub Class_Terminate
On Error Resume Next

If Not m_IIS Is Nothing Then
Set m_IIS = Nothing
End If

If Err.Number <> 0 Then
MsgBox Err.Description, vbOKOnly + vbExclamation, APP_NAME
Err.Clear()
Exit Sub
End If
End Sub

' ******************************************************************

Public Sub CreateVirtualDirectory(ByVal VirDirName, ByVal LocalPath)
Dim NewVirDir
Set NewVirDir = m_IIS.Create("IIsWebVirtualDir", VirDirName)
NewVirDir.Path = LocalPath
NewVirDir.SetInfo
NewVirDir.AppCreate True
NewVirDir.SetInfo

If Not NewVirDir Is Nothing Then
Set NewVirDir = Nothing
End If

End Sub

Public Sub DeleteVirtualDirectory(ByVal VirDirName)
On Error Resume Next
Dim VirDir
Set VirDir = m_IIS.Delete("IIsWebVirtualDir", VirDirName)
VirDir.AppDelete
m_IIS.SetInfo
Err.Clear()
End Sub
End Class
 

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

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top