Enumerating IIS Metabase (AvonWyss!!)

Posted on 2001-06-20
Last Modified: 2010-04-06
Simple question: how to enumerate all websites in webserver or virtual dirs in website.
I use GetObject() function posted here on EE by AvonWyss which look like this:
function GetObject(const AName: string):IDispatch;
    M: IMoniker;
    E: Integer;
    B: IBindCtx;
    D: IDispatch;
what I want is when:I call
I need to enum all websites in webservice returned by GetObject()
Question by:ziolko
  • 3
  • 2

Expert Comment

ID: 6212625
If you're working actually on the server, you could aways use FindFirstFile and FindNextFile to look for files from the web root downward.  (Look in the WinAPI help file.)
LVL 21

Author Comment

ID: 6213271
> Greyman but I want to get information about websites like IP port assigned, name of website or read/write site properties (Log settings, access settings, DefaultDoc, ScriptMaps, etc.) is it possible with FindFirstFile ?
LVL 14

Accepted Solution

AvonWyss earned 200 total points
ID: 6215465
Here I am. Well, it's not very hard. You need to use an IEnumVariant to enumerate all objects in a AD container. This works like this:

     FEnum: IEnumVariant;

     FEnum:=((IUnknown(Container) as IADsContainer)._NewEnum) as IEnumVariant;

then you can iterate through the items:

     FItem: OLEVariant;
     Result: LongBool;


As long as result stays True, you will have a valid item in FItem. Note that after creating the enumarator you have to call Next to get the first item (or a FALSE result if there are no items).

To check what kind of object you got in the enumaration item FItem, use the FItem.Class property which holds a string with the name of the class you're dealing with in FItem.
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

LVL 21

Author Comment

ID: 6217895
AvonWyss > I've just started palying with IADsBuildEnumerator but I recive EOleSysError in adsiis.dll, anyway I'll let You know on Monday if it worked (I supose it will work)
LVL 21

Author Comment

ID: 6223525
As I excpected, works.
Thanks, ziolko.
LVL 14

Expert Comment

ID: 6224312
You're very welcome!

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Intraweb download file link ? 1 134
Why can't I create any project with my delphi EXE file? 6 26
CheckListBox usage 3 59
Delphi: barcode reading on android platform 1 30
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question