Solved

Enumerating IIS Metabase (AvonWyss!!)

Posted on 2001-06-20
6
457 Views
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;
var
    M: IMoniker;
    E: Integer;
    B: IBindCtx;
    D: IDispatch;
begin
    OleCheck(CreateBindCtx(0,B));
    OleCheck(MkParseDisplayName(B,PWideChar(WideString(AName)),E,M));
    OleCheck(M.BindToObject(B,nil,IDispatch,D));
    Result:=D;
end;
what I want is when:I call
GetObject(IS://LocalHost/W3SVC')
I need to enum all websites in webservice returned by GetObject()
ziolko.
0
Comment
Question by:ziolko
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:Greyman
Comment Utility
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.)
0
 
LVL 21

Author Comment

by:ziolko
Comment Utility
> 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 ?
ziolko
0
 
LVL 14

Accepted Solution

by:
AvonWyss earned 200 total points
Comment Utility
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;

     FEnum.Next(1,FItem,Cardinal(Result));

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.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 21

Author Comment

by:ziolko
Comment Utility
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)
ziolko.
0
 
LVL 21

Author Comment

by:ziolko
Comment Utility
As I excpected, works.
Thanks, ziolko.
0
 
LVL 14

Expert Comment

by:AvonWyss
Comment Utility
You're very welcome!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now