Function ASTCreateFtpSite(IPAddress, RootDirectory, ServerComment, HostName, PortNum, Computer, Start,LogFileDirectory)
Dim MSFTPSVC, FtpServer, NewFtpServer, NewDir
Dim Bindings, BindingString, NewBindings, Index, SiteObj, bDone
On Error Resume Next
Set MSFTPSVC = GetObject("IIS://" & Computer & "/MSFTPSVC")
If <> 0 Then
"Unable to open: "&"IIS://" & Computer & "/MSFTPSVC" & VbCrlf & "The program will exit!"
(1)
End If
BindingString = IpAddress & ":" & PortNum & ":" & HostName
For Each FtpServer in MSFTPSVC
If ="IIsFtpServer" Then
Bindings =
If BindingString = Bindings(0) Then
"oh,IPAddress conflict:" & IpAddress & ",Please checkIPaddress!" & VbCrlf & "Cancel the creation of this site."
Exit Function
End If
End If
Next
Index = 1
bDone = False
While (Not bDone)
Set SiteObj = GetObject("IIS://"&Computer&"/MSFTPSVC/" & Index)
If ( = 0) Then
Index = Index + 1
Else
Set NewFtpServer = ("IIsFtpServer", Index)
If ( <> 0) Then
Index = Index + 1
Else
Set SiteObj = GetObject("IIS://"&Computer&"/MSFTPSVC/" & Index)
If ( = 0) Then
bDone = True
Else
Index = Index + 1
End If
End If
End If
If (Index > 10000) Then
"oh,Create site exception!The serial number of the site being created is:"&Index&"." & VbCrlf & "Cancel the creation of this site."
Exit Function
End If
Wend
NewBindings = Array(0)
NewBindings(0) = BindingString
= NewBindings
= ServerComment
= False
= True
= True
= False
= LogFileDirectory
Set NewDir = ("IIsFtpVirtualDir", "ROOT")
= RootDirectory
= true
If ( = 0) Then
Else
"oh,An error occurred while creating the home directory!"
End If
If Start = True Then
Set NewFtpServer = GetObject("IIS://" & Computer & "/MSFTPSVC/" & Index)
If <> 0 Then
"oh,An error occurred while starting the site!"
Else
End If
End If
ASTCreateFtpSite = Index
End Function
Dim MSFTPSVC, FtpServer, NewFtpServer, NewDir
Dim Bindings, BindingString, NewBindings, Index, SiteObj, bDone
On Error Resume Next
Set MSFTPSVC = GetObject("IIS://" & Computer & "/MSFTPSVC")
If <> 0 Then
"Unable to open: "&"IIS://" & Computer & "/MSFTPSVC" & VbCrlf & "The program will exit!"
(1)
End If
BindingString = IpAddress & ":" & PortNum & ":" & HostName
For Each FtpServer in MSFTPSVC
If ="IIsFtpServer" Then
Bindings =
If BindingString = Bindings(0) Then
"oh,IPAddress conflict:" & IpAddress & ",Please checkIPaddress!" & VbCrlf & "Cancel the creation of this site."
Exit Function
End If
End If
Next
Index = 1
bDone = False
While (Not bDone)
Set SiteObj = GetObject("IIS://"&Computer&"/MSFTPSVC/" & Index)
If ( = 0) Then
Index = Index + 1
Else
Set NewFtpServer = ("IIsFtpServer", Index)
If ( <> 0) Then
Index = Index + 1
Else
Set SiteObj = GetObject("IIS://"&Computer&"/MSFTPSVC/" & Index)
If ( = 0) Then
bDone = True
Else
Index = Index + 1
End If
End If
End If
If (Index > 10000) Then
"oh,Create site exception!The serial number of the site being created is:"&Index&"." & VbCrlf & "Cancel the creation of this site."
Exit Function
End If
Wend
NewBindings = Array(0)
NewBindings(0) = BindingString
= NewBindings
= ServerComment
= False
= True
= True
= False
= LogFileDirectory
Set NewDir = ("IIsFtpVirtualDir", "ROOT")
= RootDirectory
= true
If ( = 0) Then
Else
"oh,An error occurred while creating the home directory!"
End If
If Start = True Then
Set NewFtpServer = GetObject("IIS://" & Computer & "/MSFTPSVC/" & Index)
If <> 0 Then
"oh,An error occurred while starting the site!"
Else
End If
End If
ASTCreateFtpSite = Index
End Function