Windows Script host "error" running script "object required"

I am getting an error running a loging script, below is ther start of the script and it errors on line 43, char 1, error "object required: 'ObjgroupDict', Code 800A01A8, source MS VBScript runtime error.   If I run it on a W2K3 server there is no error, if I run it on W2K server it presents this error.  Is there something about W2K3, .net version, etc.?  pease help

btw: line 43 is:

MemberOf = CBool(ObjGroupDict.Exists(strKey))


'*******************************************************************
'*                    Variable Declarations                        *
'*******************************************************************

Option Explicit ' Force explicit declarations

Dim WSHNetwork
Dim WSHFSO
Dim WSHShell
Dim strUserName ' Current user
Dim strUserDomain ' Current User's domain name
Dim ObjGroupDict ' Dictionary of groups to which the user belongs
Dim objshell
Dim objExecObject
Dim objUser, objGroup

Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WSHFSO = CreateObject("Scripting.FileSystemObject")


'*******************************************************************
'*                    Get Variables Ready                          *
'*******************************************************************

strUserName = ""
While strUserName = ""
WScript.Sleep 100 ' 1/10 th of a second
strUserName = WSHNetwork.UserName
Wend
strUserDomain = WSHNetwork.UserDomain


Function MemberOf(ObjDict, strKey)
MemberOf = CBool(ObjGroupDict.Exists(strKey))
End Function


Function CreateMemberOfObject(strDomain, strUserName)


Set CreateMemberOfObject = CreateObject("Scripting.Dictionary")
CreateMemberOfObject.CompareMode = vbTextCompare
Set objUser = GetObject("WinNT://" _
& strDomain & "/" _
& strUserName & ",user")
For Each objGroup In objUser.Groups
CreateMemberOfObject.Add objGroup.Name, "-"
Next
Set objUser = Nothing

End Function


'*******************************************************************
'*                    Login Script Starts Now                      *
'*******************************************************************
LVL 1
GlobalFaxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ptan218Commented:
You have declare the variable ObjGroupDict but have not assign any object instance to it.

Without assigning and object instance to ObjGroupDict, where are are you going to find the Exist method?
0
DeadlyTrevCommented:
Perhaps the line;
    MemberOf = CBool(ObjGroupDict.Exists(strKey))

should actually be ...
    MemberOf = CBool(ObjDict.Exists(strKey))
0
ptan218Commented:
It's the same thing. Where is your object instance for ObjDict? Try this.

Function MemberOf(ObjDict, strKey)
    set ObjGroupDict = CreateObject("Scripting.Dictionary")
    MemberOf = CBool(ObjGroupDict.Exists(strKey))
End Function
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ptan218Commented:
or

Function MemberOf(ObjDict, strKey)
    set ObjDict = CreateObject("Scripting.Dictionary")
    MemberOf = CBool(ObjDict.Exists(strKey))
End Function
0
DeadlyTrevCommented:
We need to see the rest of your scripting code to know one way or another ....
0
Leo EikelmanDirector, IT and Business DevelopmentCommented:
yeah I don't understand

you created a variable

Dim ObjGroupDict

but you havent set the variable to dictionary object.

How can u see if it exists when you havent even set it to anything?

Leo
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.