tags:

views:

146

answers:

3

I'm using IIS 6 on Windows Server 2003. The vision is to create a directory of those applications, showing their urls (ports on Server) and names.

+1  A: 

I haven't done it, but I believe you need to use the following WMI object:

DirectoryEntry w3svc = new DirectoryEntry(string.Format("IIS://{0}/w3svc", serverName));
foreach (DirectoryEntry site in w3svc.Children)
{
     //these are the web sites, lookup their properties to see how to extract url
}
Grzenio
A: 

C# example: link text

or

This is a VB example, but I think you will use this idea: link text

strComputer = "."

Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
    & strComputer & "\root\microsoftiisv2")
Set colItems = objWMIService.ExecQuery("Select * from IIsWebVirtualDir")
For Each objItem in colItems
  Wscript.Echo "Application Isolated: " & objItem.AppIsolated
  Wscript.Echo "Application Package ID: " & objItem.AppPackageID
  Wscript.Echo "Application Package Name: " & objItem.AppPackageName
  Wscript.Echo "Application Root: " & objItem.AppRoot
  Wscript.Echo "Installation Date: " & objItem.InstallDate
  Wscript.Echo "Name: " & objItem.Name
Next
Icebob
That script lists Vdirs, not Web sites.
Cheeso
Really, sorry man
Icebob
A: 

In addition to above solutions, assuming if your application is not running on the same server machine where the IIS is, in that case you will need to write a TCPClient to perform Reverse DNS on the IP of the IIS server.

By defination Reverse DNS means:

In computer networking, reverse DNS lookup or reverse DNS resolution (rDNS) is the determination of a domain name that is associated with a given IP address using the Domain Name System (DNS) of the Internet.

this. __curious_geek