Dim W3svc,webserver,bindings,allbindinginfo,fs,textfilepath,websitename
On Error Resume Next
Err.Clear
Set fs = WScript.CreateObject ("Scripting.FileSystemObject")
Textfilepath = fs. GetFile (Wscript.scriptfullname). Parentfolder.path & "\iisbindingcheck.tmp"
Allbindinginfo = ""
computer = "localhost"
Set w3svc = GetObject ("iis://" & Computer & "/w3svc")
For each WebServer in W3SVC
If IsNumeric (Webserver.name) Then
Websitename = Webserver.servercomment
Bindings = webserver.serverbindings
For i = LBound (Bindings) to UBound (Bindings)
Bindinginfo = Bindings (i)
Nstart = InStr (Bindinginfo, ":")
IP = Mid (bindinginfo,1,nstart-1)
Nend = InStr (Nstart + 1,bindinginfo, ":")
Port = Mid (Bindinginfo,nstart + 1, nend-nstart-1)
Allbindinginfo = allbindinginfo & IP & ":" & Port & ":" & Websitename & VbCrlf
Next
End If
Next
Allbindinginfo = Left (Allbindinginfo,len (Allbindinginfo)-2)
Fs. CreateTextFile (Textfilepath). Write Allbindinginfo
VBS gets information about the Web site in local IIS (IP, port, site name)