IIS 6: Creating an Itemized List of Server Bindings

One of my servers has a large number of individual web sites on it, and each of these web sites has several server bindings for different IP addresses, Port Assignments, and Host Headers. As I continue to add more web sites on the server, it becomes increasingly difficult to keep track of all the details using the IIS user interface.

With that in mind, I wrote the following ADSI script which creates a text file that contains an itemized list of all server bindings on a server.

Option Explicit
On Error Resume Next

Dim objBaseNode, objChildNode
Dim objBindings, intBindings
Dim objFSO, objFile, strOutput

' get a base object
Set objBaseNode = GetObject("IIS://LOCALHOST/W3SVC")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("ServerBindings.txt")

' check if if have an error ...
If (Err.Number <> 0) Then

    ' ... and output the error.
    strOutput = "Error " & Hex(Err.Number) & "("
    strOutput = strOutput & Err.Description & ") occurred."

' ... otherwise, continue processing.
    ' loop through the child nodes
    For Each objChildNode In objBaseNode
        ' is this node for a web site?
        If objChildNode.class = "IIsWebServer" Then
            ' get the name of the node
            strOutput = strOutput & "LM/W3SVC/" & _
            ' get the server comment
            strOutput = strOutput & " (" & _
                objChildNode.ServerComment & ")" & vbCrLf
            ' get the bindings
            objBindings = objChildNode.ServerBindings
            ' loop through the bindings
            For intBindings = 0 To UBound(objBindings)
                strOutput = strOutput & vbTab & _
                    Chr(34) & objBindings(intBindings) & _
                    Chr(34) & vbCrLf
        End If
    ' try not to be a CPU hog
    Wscript.Sleep 10
End If

objFile.Write strOutput

Set objBaseNode = Nothing
Set objFSO = Nothing

Hope this helps!

To geek, or not to geek...

Like most of the computer-obsessed friends that I hang out with, I am often called a geek by the non-techie types that I have to interact with. (That list of non-techies includes my wife, by the way. ;-])

I wondered if that was a label that I should wear with pride, then I saw a great quote the other day:

"A Geek is someone who is passionate about some particular area or subject, often an obscure or difficult one."

Given my over-interest in computers, maybe the "Geek" title fits.

When discussing several subjects with some other geeks the other day, one of my friends asked, "Is it possible that there is anything that you're not a geek in?"

I had to give that some thought, but then I replied, "Shoes."

To be honest, I wear a set of sneakers just about everywhere. I wouldn't know a good set of dress shoes if they snuck up behind me and kicked me in the rear.

Maybe that's why I have such a hard time understanding why my wife owns 40 pairs of shoes... To me, I figure what's the point?

To be honest, I actually do own a couple of other pairs of shoes, but my wife bought them for me. When all is said and done, all I ever wear is the sneakers. (Even to church... ;-])

I think my wife buys my other shoes for me in the hopes that I will either: 1) empathize with her plight, 2) convert to the dark side, or 3) develop some form of shoe-fetish gland. I think the fact that I work for Microsoft has still escaped her.

I've told my daughters that I'm making them a simple deal: I'll wear a tuxedo for their weddings. If I foot the bill for the wedding, then I'm wearing sneakers with the tux. If they pay for their own wedding, then I'll wear whatever shoes they like.

Seems fair to me.  ;-]

But the question remains, am I a socially hopeless cause? I hope not. (After all, I do get out a lot.)

Am I a geek? Hmm... I guess I should consider the old adage:

"If the shoe fits..."

Well, you know the rest. ;-]