View Full Version : VBscript join command causing script to fail


daragh
Im using VBscript to write new logon scripts, when i run
the script as any user with domain admin rights it runs
ok, but when Its run by a standard user it fail due to the
join command. i have tried giving the user local admin
rights but thats not working,

Here is a sample of the script, any help would be
appreciated:

Const FINANCE = "cn=finance"
Const HR = "cn=hr"


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

If InStr(strGroups, FINANCE) Then

wshNetwork.MapNetworkDrive "j:", "\\SERVER\FINANCE"

ElseIf InStr(strGroups, HR) Then

wshNetwork.MapNetworkDrive "j:", "\\SERVER\HR"

end if

Chris
I'm having the exact same problem with a similar script.
When I run the script as a domain admin it runs find and
returns a list of groups, when I run the script as a
domain user it returns no groups.

Here is a sample of my script (similar to yours).
'################################
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
Set AllDrives = WshNetwork.EnumNetworkDrives()

msgbox(ADSysInfo.UserName)

strGroups = Join(CurrentUser.MemberOf)

MyUsername = Right(CurrentUser.Name, Len(CurrentUser.Name)-
3)
msgbox(MyUsername)
msgbox(strgroups)

If InStr(strGroups, "cn=sample group") Then
wshNetwork.AddWindowsPrinterConnection "\\mchprn"
& psrv & "\laser1@3neast"
End If

(the msgbox are for troubleshooting purposes).

I checked the permissions on the domain to ensure
Authenticated Users have Read and List Contents to Group
Objects and OU's. Not sure what else to check.

If anyone can assist, I would be really grateful. We are
in the middle of a Windows 2000 rollout and it would be
much easier to map drives and printers based upon group
membership.

If course the other way to fix this problem, I told our
Security Administrator that I was going to add Domain
Users group to the Domain Admins group. (Just Kidding)

Thanks in Advance
Chris

>-----Original Message-----
>Im using VBscript to write new logon scripts, when i run
>the script as any user with domain admin rights it runs
>ok, but when Its run by a standard user it fail due to
the
>join command. i have tried giving the user local admin
>rights but thats not working,
>
>Here is a sample of the script, any help would be
>appreciated:
>
>Const FINANCE = "cn=finance"
>Const HR = "cn=hr"
>
>
>Set ADSysInfo = CreateObject("ADSystemInfo")
>Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
>strGroups = LCase(Join(CurrentUser.MemberOf))
>
>If InStr(strGroups, FINANCE) Then
>
>wshNetwork.MapNetworkDrive "j:", "\\SERVER\FINANCE"
>
>ElseIf InStr(strGroups, HR) Then
>
>wshNetwork.MapNetworkDrive "j:", "\\SERVER\HR"
>
>end if
>.
>