johndoe
Mon Oct 04 03:30:35 CDT 2004
Thanks. The missing link was the IEnumerator that DirectoryEntry.Children
had. I did not realize that it had a Iterator/Enumerator that i could grab.
"Kristofer Gafvert" <kgafvert@NEWSilopia.com> wrote in message
news:uCz1MoeqEHA.592@TK2MSFTNGP11.phx.gbl...
> And a list of IIsWebServer metabase properties can be found in MSDN here:
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_prog_iaorefiws.asp
>
> --
> Regards,
> Kristofer Gafvert
>
http://www.ilopia.com
>
>
> "Kristofer Gafvert" <kgafvert@NEWSilopia.com> wrote in message
> news:eni7eleqEHA.1960@TK2MSFTNGP10.phx.gbl...
>> Hello,
>>
>> Here's some example code i wrote for you:
>>
>> using System.DirectoryServices;
>> using System;
>>
>> public class EnumWebsites
>> {
>> public static void EnumerateWebsites()
>> {
>> DirectoryEntry node = new DirectoryEntry("IIS://localhost/W3SVC");
>>
>> foreach (DirectoryEntry e in node.Children)
>> {
>> if( e.SchemaClassName == "IIsWebServer")
>> {
>> Console.WriteLine("ID: " + e.Name + " Comment: " +
>> e.Properties["ServerComment"].Value.ToString());
>> }
>> }
>> }
>>
>> static void Main(string[] args)
>> {
>> EnumerateWebsites();
>> }
>> }
>>
>> --
>> Regards,
>> Kristofer Gafvert
>>
http://www.ilopia.com
>>
>>
>> <johndoe@driver.net> wrote in message
>> news:%23vyXFvdqEHA.1988@TK2MSFTNGP09.phx.gbl...
>> > I am looking for (preferably C# but at this point i am not very picky
>> since
>> > hours of google and google group scouring has turned up nothing) for
>> sample
>> > code on enumerating all of the websites in IIS. I am leaning towards
> ADSI
>> as
>> > this has the possibility of working on more platforms however as I have
>> seen
>> > code that works on IIS 5.1 crashes on 2k3 but I am hoping for a more
>> > "cross-platformable" code via the ADSI provider.
>> >
>> > I currently have
>> > DirectoryEntry W3SVC = new DirectoryEntry("IIS://localhost/w3svc");
>> >
>> > - Now to my way of thinking everything under w3svc will be the
>> > websites.
>> And
>> > this would be exposed via the Children however the Children exposes
>> > only
>> one
>> > method of access a "Find" method which would be cool if our code was
>> psychic
>> > and already knew all of the website id's.
>> >
>> > Meanwhile back in the real world! We are left looking for a method
>> that
>> > plain and simply enumerates the websites.
>> >
>> > Is anybody able to shed some light on this matter
>> >
>> >
>>
>>
>
>