Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Enumerating IIS Metabase (AvonWyss!!)

Posted on 2001-06-20
6
480 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
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.)
0
 
LVL 21

Author Comment

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

Accepted Solution

by:
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;

     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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 21

Author Comment

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

Author Comment

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

Expert Comment

by:AvonWyss
ID: 6224312
You're very welcome!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 73
Delphi Mdi application Child forms get behind control 7 268
Delphi selector screen 2 84
RESTRequest Parameter 4 41
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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