From Bistre Meerkat, 5 Years ago, written in Visual Basic.
This paste is a reply to from
- view diff
Embed
  1. on error resume next
  2.  
  3. set NETWORK=createobject("wscript.network")
  4. set SHELLAP=createobject("shell.application")
  5. set ADINFO =CreateObject("adsysteminfo")
  6. set FSO    =createobject("scripting.filesystemobject")
  7. set APSHELL=createobject("shell.application")
  8.  
  9. APSHELL.namespace("H:").self.name="Home"
  10.  
  11. set DRIVES=NETWORK.enumnetworkdrives
  12. for i = 0 to DRIVES.Count-1 Step 2
  13.  if not DRIVES.item(i) = "H:" then NETWORK.removenetworkdrive DRIVES.item(i)
  14. Next
  15.  
  16. set USER=getobject("LDAP://" & ADINFO.username)
  17. if isarray(USER.memberof) then
  18.  GROUPS=lcase(join(USER.memberof))
  19. else
  20.  GROUPS=lcase(USER.memberof)
  21. end if
  22.  
  23. DRIVE_ARRAY=_
  24. "I,Public,\\File01\Common"&"|"&_
  25. "R,Programs,\\File01\Programs"&"|"&_
  26. "T,Teacher Share,\\File01\Staffshare"&"|"&_
  27. "S,Student Homes,\\File01\Students"&"|"&_
  28. "N,Admin,\\File01\admin"
  29.  
  30. DRIVE_ARRAY=split(DRIVE_ARRAY,"|")
  31. for ii=0 to ubound(DRIVE_ARRAY)
  32.  DRIVE_ARRAY(ii)=split(DRIVE_ARRAY(ii),",")
  33. next
  34.  
  35. if instr(GROUPS,"visitors") then MapDrives("IR")
  36. if instr(GROUPS,"wgs-allstudents") then MapDrives("IRH")
  37. if instr(GROUPS,"wgs-allstaff") then MapDrives("IRSTH")
  38. if instr(GROUPS,"admins") then MapDrives("IRSTN")
  39. 'if instr(GROUPS,"class") then
  40. ' ROOMNUMBER=mid(GROUPS,instr(GROUPS,"room")+4,2)
  41. ' ROOMPATH="\\File01\data$\student\user\Room "&ROOMNUMBER&"\!Class Folder"
  42. ' if FSO.folderexists(ROOMPATH) then
  43. '  NETWORK.mapnetworkdrive "M:",ROOMPATH
  44. '  SHELLAP.namespace("M:").self.name="Room "&ROOMNUMBER
  45. ' end if
  46. 'end if
  47.  
  48. sub MapDrives(DRIVE_STRING)
  49.  for ii=1 to len(DRIVE_STRING)
  50.   LETTER=mid(DRIVE_STRING,ii,1)
  51.   for each DRIVE_INFO in DRIVE_ARRAY
  52.    if instr(DRIVE_INFO(0),LETTER) then
  53.     NETWORK.mapnetworkdrive DRIVE_INFO(0)&":",DRIVE_INFO(2)
  54.     SHELLAP.namespace(DRIVE_INFO(0)&":").self.name=DRIVE_INFO(1)
  55.     exit for
  56.    end if
  57.   next
  58.  next
  59. end sub
  60.  
  61.  

Replies to Re: WGS - Login rss

Title Name Language When
Pines Login - in progress Emerald Dolphin vb 5 Years ago.