David
Mon Nov 13 05:11:23 CST 2006
I started writing a long response, so I moved it to a blog entry that I
will post later.
Short answer:
1. Using metabase.xml directly is the wrong approach for many reasons.
2. The code snippet you show will only dump AuthFlags at the W3SVC/1
(IIsWebServer) level. If your code treats W3SVC/1/AuthFlags (the full
bitflag for AuthAnonymous, AuthBasic, etc) as the effective value shown
by IIS Manager UI as authentication settings for the website, then it
is mistaken. The fact it "works" with IIS5 is irrelevant if the code's
logic is wrong - it only says that the code haphazardly works.
FYI: your own statements back up my observations. You are having
problems with per-URL level properties like AuthFlags but not
website-level properties like LogFileDirectory - which can be the case
if you misunderstand how IIS determines effective property values from
configuration.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
goshi key wrote:
> Thanks for referring me to this but I already have something very similar.
>
> BTW, my code works with IIS5 but not IIS6. I'm going to read directly from
> metabase.xml as a workaround.
>
>
> "Highlander" <tron9901@msn.com> wrote in message
> news:1163200080.889035.52040@e3g2000cwe.googlegroups.com...
> > Enumerate IIS website and ftpsite configuration (VBScript using ADSI):
> >
> >
http://blogs.msdn.com/david.wang/archive/2006/06/08/HOWTO_Enumerate_IIS_website_and_ftpsite_configuration_VBScript_using_ADSI.aspx
> >
> > goshi key wrote:
> >> David, the full code recurses through the metabase hierarchy by passing
> >> the
> >> adspath property for each WebServerObject back to the sub and it
> >> accurately
> >> displays other site attributes (i.e; log file directory, active log file
> >> format, extended logging options, etc.). I'm seeing this problem with
> >> some
> >> properties (AuthAnonymous, AuthBasic, AuthNTLM) but not others.
> >>
> >> g
> >>
> >> "David Wang" <w3.4you@gmail.com> wrote in message
> >> news:1163196349.194548.212310@i42g2000cwa.googlegroups.com...
> >> > You are not querying and displaying values with the proper logic. You
> >> > are probably trying to determine the EFFECTIVE authentication protocols
> >> > at a given URL, but that is not what your code produces. Thus, it does
> >> > not match what the IIS Manager UI displays.
> >> >
> >> > IIS metabase is hierarchical with inheritance.
> >> > - Your code will only display data at the W3SVC/1 (i.e. IIsWebServer)
> >> > level.
> >> > - Meanwhile, IIS is showing data at the W3SVC/1/ROOT (i.e.
> >> > IIsWebVirtualDir) level and below
> >> >
> >> > AuthFlags can be set differently between W3SVC/1 and W3SVC/1/ROOT, with
> >> > the one at W3SVC/1/ROOT taking precedence for the website, IF IT
> >> > EXISTS.
> >> >
> >> >
> >> > //David
> >> >
http://w3-4u.blogspot.com
> >> >
http://blogs.msdn.com/David.Wang
> >> > //
> >> >
> >> >
> >> >
> >> > goshi key wrote:
> >> >> I'm using vbscript to query IIS via ADSI to find out whether settings
> >> >> such
> >> >> as "Enable anonymous access", "Integrated Windows authentication"
> >> >> and/or
> >> >> "Basic authentication" are enabled for each site. Eventhough I map an
> >> >> object
> >> >> to the specific ADSPath for the site, the results do not match what is
> >> >> being
> >> >> indicated by the IIS Manager MMC. The following is an abridged version
> >> >> of
> >> >> the code in use:
> >> >>
> >> >> Sub ScanMetabaseTree(sADSPath)
> >> >> 'On Error Resume Next
> >> >> Set objIIS = GetObject(sADSPath)
> >> >> For Each oBject in objIIS
> >> >> If (oBject.Class = "IIsWebServer") AND
> >> >> (IsNumeric(oBject.Name))
> >> >> Then
> >> >> WScript.Echo oBject.ServerComment
> >> >> WScript.Echo oBject.Name
> >> >> WScript.Echo oBject.ADSPath
> >> >> WScript.Echo oBject.AccessFlags
> >> >> WScript.Echo oBject.AccessRead
> >> >> WScript.Echo oBject.AccessWrite
> >> >> WScript.Echo oBject.AccessScript
> >> >> WScript.Echo oBject.AccessSource
> >> >> WScript.Echo oBject.AuthAnonymous
> >> >> WScript.Echo oBject.AnonymousUserName
> >> >> WScript.Echo oBject.AnonymousUserPass
> >> >> WScript.Echo oBject.AuthBasic
> >> >> WScript.Echo oBject.AuthNTLM
> >> >> WScript.Echo oBject.AuthFlags
> >> >> WScript.Echo oBject.DirBrowseFlags
> >> >> End If
> >> >> ScanMetabaseTree(oBject.ADSPath)
> >> >> Next
> >> >> End Sub
> >> >>
> >> >>
> >> >> Any idea what I'm doing wrong? Is there any other way to check each
> >> >> site
> >> >> for
> >> >> these properties?
> >> >>
> >> >> Thanks in advance
> >> >
> >