[AccessD] OT: VBScript failing on login

Christopher Hawkins clh at christopherhawkins.com
Fri Nov 28 16:02:29 CST 2003


Greetings.

I wrote a login script for a client some time ago. Part of the script
is a function that creates a comma-delimited list of what groups the
logging-in user belongs to. The script has been working perfectly
until this morning, when the IsMember function started failing. The
IT guys have been making configuration changes to various servers,
but can't tell me what exactly those changes are. 

My only clue is that g_oNet.UserDomain comes back with no value. I'm
not sure why that would be. All the client machines have the Windows
Scripting Host, Windows Management Instrumentation and ADSI
installed. 

There are globals at the top of the script:
' Globals
Dim g_oGroupDict
Dim g_oNet
dim g_sGroupList

...and this function, which is failing, at the bottom:


Function IsMember(sGroup)
' Creates a comma-delimited list of groups to which the user belongs.

    msgbox "IsMember..." & sGroup	' DEBUG

    Dim sAdsPath
    Dim oUser
    Dim oGroup

    ' Populate dictionary if not already created.

    If IsEmpty(g_oGroupDict) Then
	msgbox "GROUPS DICTIONARY IS EMPTY...BUILDING DICTIONARY..."
        Set g_oGroupDict = CreateObject("Scripting.Dictionary")
        g_oGroupDict.CompareMode = vbTextCompare
        sAdsPath = g_oNet.UserDomain & "/" & g_oNet.UserName

	msgbox "g_oNet.UserDomain = " & g_oNet.UserDomain
	msgbox "USER PATH = " & sAdsPath	' DEBUG

	set oUser = GetObject("WinNT://DOMAINABC/" & sUser)

        For Each oGroup In oUser.Groups
	    msgbox "MEMBER OF: " & oGroup.name	' DEBUG
            g_oGroupDict.Add oGroup.Name, " - "
	    g_sGroupList = oGroup.Name & ", " & g_sGroupList
        Next

        Set oUser = Nothing
        msgbox "ALL GROUPS = " & g_sGroupList
    End If

    IsMember = CBool(g_oGroupDict.Exists(sGroup))
    msgbox "End IsMember = " & IsMember

msgbox err.number & " - " & err.description,"IsMember"

End Function
I'm very confounded. The script has been running successfully for
weeks now, and no changes have been made (save for the various MsgBox
statements I've been using this morning to debug it). The machine
this script runs on is a PDC.

More info: the script still executes successfully for XP clients. The
98 clients are the ones that cannot execute the script. And the PDC
that the users authenticate against is an NT4 machine.

I am well and truly stumped.
-Christopher-




More information about the AccessD mailing list