views:

156

answers:

2

I have an app that accesses information about websites running on IIS on a remote machine, using DirectoryEntry objects (in System.DirectoryServices).

Any client machine that runs the app needs to have IIS installed or the app throws a System.Runtime.InteropServices.COMException when it accesses the IIS information.

Is there a way I can just include a dll, add a reference, or something similar to be able to access that information without the client machine installing IIS? Or is there a better way to access that information (without System.DirectoryServices, perhaps) that would also bypass this requirement?

EDIT: Looking at this problem again, and seeing the questions here and here, I believe it is not possible to use DirectoryServices to get this information. I'll leave it open for alternatives to be suggested, maybe more info on WBEM scripts?

+1  A: 

So what I understand is that you're trying to get website info from remote IIS servers, but the client that is trying to get that information must have IIS installed in order to be able to query those remote systems. And it's not because it's using some kind of web-app to get the info; it's using some functionality that is installed when IIS is installed.

What kind of information are you after? Can't you use WBEM scripts targeting the IIS machine to get the information you're after?

Chris
I don't know, what's a WBEM script? ;) I'm trying to get file paths and website names/friendly names of any website running in IIS. Apart from requiring IIS to be installed on the client, DirectoryServices works great.
pete the pagan-gerbil
A: 

After further research:

Chris was talking about WMI scripts and the System.Management namespace, which works fine as long as you're connecting to IIS 6 or above.

DirectoryServices needs IIS installed, because it adds extra bits to ADSI that allow it to query IIS. In addition, you need to install an IIS 6 compatibility manager if you're using IIS 5 (Windows XP) or IIS 7 (Windows 7) to get the right ADSI components.

There is a final alternative for IIS 7, which is the Microsoft.Web.Administration namespace.

Unfortunately, in my scenario I need to use both IIS 5 and IIS 6, meaning that DirectoryServices is the only way to get what I need. Luckily, I believe only a compatibility manager needs to be installed rather than the whole IIS server (hopefully this is an option on Windows XP...)

Accepted Chris as the answer for the suggestion on WBEM, even though I can't use it in this case!

pete the pagan-gerbil