One more of many to you, Thanks!
jlc

From: Michael B. Smith [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2008 12:12 PM
To: NT System Admin Issues
Subject: RE: Problem with Logon Script

Because CurrentUser.MemberOf may contain zero, one, or many results.

This error exists in several Microsoft scriptcenter scripts.

Therefore:

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
objVar = currentUser.MemberOf
If IsEmpty(objVar) or IsNull(objVar) Then
                strGroups = ""
ElseIf IsArray(objVar) Then
strGroups = LCase(Join(CurrentUser.MemberOf))
Else
                strGroups = objVar
End If

Regards,

Michael B. Smith, MCITP:SA,EMA/MCSE/Exchange MVP
My blog: http://TheEssentialExchange.com/blogs/michael
Link with me at: http://www.linkedin.com/in/theessentialexchange

From: Joseph L. Casale [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2008 1:01 PM
To: NT System Admin Issues
Subject: Problem with Logon Script

I have a Win2ksp2 AD setup with WinXP clients,

Why does this *sometimes" work:

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))


And this always work:

strADsPath = "WinNT://<netbios dom name>/" & strUserName
Set objADs = GetObject(strADsPath)
For Each objMember In objADs.Groups
                strGroups = strGroups + "cn=" + LCase(objMember.Name)
Next

Any ideas?
Thanks!
jlc












~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to