I need help from the Super Coders

Author Message
mathew

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 1/6/2012
  • Status: offline
I need help from the Super Coders Wednesday, January 11, 2012 11:42 AM (permalink)
0
Hi guys. Based on the fast response I got in my last post. I was assigned a new project, and got so far: I need more help. Essentially the following code returns the Groups the Current logged in user is part of. I want to then string compare the Group to a const MedicalLab "CN=Medical Lab" and them map the appropriate drive. We have over 130 groups. any help.THANKS
Option Explicit

On Error Resume Next
Dim objNetwork, strDomain, strUser, objUser, objGroup, strGroupMemberships, colDrives, i



' Get the domain and username from the WScript.Network object
Set objNetwork = CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
strDomain = objNetwork.UserDomain
strUser = objNetwork.UserName

' Instanciate the user object from the data above
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser)

'Force Removal of network drive
For i = 0 to colDrives.Count-1 Step 2
objNetwork.RemoveNetworkDrive colDrives.Item(i),TRUE,TRUE
Next
WScript.sleep 2000         

' Run through the users groups and put them in the string
For Each objGroup In objUser.Groups
strGroupMemberships = strGroupMemberships & objGroup.Name & " , "
Next

MsgBox strGroupMemberships
 
 
#1
    59cobalt

    • Total Posts : 975
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:I need help from the Super Coders Wednesday, January 11, 2012 9:15 PM (permalink)
    0
    mathew
    I want to then string compare the Group to a const MedicalLab "CN=Medical Lab" and them map the appropriate drive.
    That comparison will always evaluate to False, because your constant uses LDAP notation while the group names returned by the user object's .Groups property don't.
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9