Announcement

Collapse
No announcement yet.

non-admin users won't map drive

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • non-admin users won't map drive

    Hello. Running a map drive script. Receiving 'Error: Type Mismatch: 'Join'. The script works as long as the user is an Administrator. Non admin users receive the error. I've looked at this problem and here is what I found from another user:

    "The reason why my script doesn't work well is because JOIN failed to work because it failed to bind to the LDAP object specified and it returned NULL; therefore, JOIN failed trying to concatenate the array into strings. It seems ordinary domain users do NOT have the necessary permission to bind to an LDAP object if they are not given permission epxlicitly. Regardless of why domain users can't bind to its own object in AD, the following code should work without any problems."

    I tried his script, that didnt work either. before i troubleshoot his script, maybe someone can help me with my original. is there a way around this non-administrator issue using the simple script i have?


    '-----------------------------------------------------------------'
    Option Explicit
    Dim objNetwork, objUser, CurrentUser
    Dim strGroup

    ' Initialise Groups with Const 11
    Const mistechnical = "cn=mistechnical"
    Const rad_forms = "cn=rad_forms"

    ' Create objects and extract strGroup values
    Set objNetwork = CreateObject("WScript.Network")
    Set objUser = CreateObject("ADSystemInfo")
    Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
    strGroup = LCase(Join(CurrentUser.MemberOf))

    ' If logic testing strGroup for the values in Const groups

    On Error Resume Next
    objNetwork.RemoveNetworkDrive "n:"
    If InStr(strGroup, lcase(MISTECHNICAL)) Then
    WScript.Echo "Technical Group, this is a test message."
    objNetwork.MapNetworkDrive "n:", "\\filesrv02\mis"

    On Error Resume Next
    objNetwork.RemoveNetworkDrive "r:"
    If InStr(strGroup, lcase(rad_forms)) Then
    WScript.Echo "rad_forms"
    objNetwork.MapNetworkDrive "r:", "\\filesrv02\rad_forms"
    End If

    End If

    ' Wscript.Echo "and so is this... Finished running your login script."
    WScript.Quit

    ' End of gshlogin VBScript .

  • #2
    Re: non-admin users won't map drive

    Here is what i have been doing for a similar problem...

    I think this is a known problem with JOIN depending on how many groups are associtated with the user... I think.

    Code:
    Dim strGroup, colGroups,
    
    Set objUser = CreateObject("ADSystemInfo")
    Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
    
    colGroups = CurrentUser.memberOf
    If IsEmpty(colGroups) Then
    strGroup = ""
    ElseIf TypeName(colGroups) = "String" Then
    strGroup = LCase(colGroups)
    Else
    strGroup = LCase(Join(colGroups))
    End If
    Hope that helps you out a bit.
    Last edited by Mseeley; 9th August 2006, 22:05.

    Comment


    • #3
      Re: non-admin users won't map drive

      I want to thoroughly thank you, Mseeley, for posting this. I'm very new to VBscript and have been trying almost the entire day to get this membership script working.

      I'm with you on this JOIN problem in regard to the group number. I have this problem when the user is a member of only one group (not including the primary group). I'm guessing there is nothing to "join" (since there is only one group) so it fails (?)

      Comment

      Working...
      X