I am trying to write a logon script for users logging into Windows 2003
terminal server. I need to determine what usergroups they belong to. I
downloaded two scripts and the first one only works for users in the
administrator group. The second script works for all users. I'm thinking it
is an Active Directory security setting. For my own education, how can I
make the first script work for all users.
Thanks for your help

' Only works for administrators
Set objADSysInfo = CreateObject("ADSystemInfo")
strUser = objADSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
For Each strGroup in objUser.memberOf
Set objGroup = GetObject("LDAP://" & strGroup)
Wscript.Echo objGroup.CN
Next

' works for everybody
Set WshShell = WScript.CreateObject("WScript.Shell")
strDomain = WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
strUserName = WshShell.ExpandEnvironmentStrings("%USERNAME%")
Set objUser = GetObject("WinNT://"& strDomain &"/"& strUserName, user)
For Each objGroup In objUser.Groups
If strGroupList = "" Then
strGroupList = objGroup.Name
Else
strGroupList = strGroupList & ", " & objGroup.Name
End If
Next
WScript.Echo strGroupList