From Emerald Dolphin, 5 Years ago, written in Visual Basic.
This paste is a reply to Re: WGS - Login from Bistre Meerkat
- 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. "L,Students,\\studentserver\Students"&"|"&_
  25. "P,Programs,\\studentserver\Programs"&"|"&_
  26. "Q,Apps,\\studentserver\data$\Apps"&"|"&_
  27. "R,Library,\\lib1\Bookmark"&"|"&_
  28. "T,Teacher Share,\\studentserver\school"&"|"&_
  29. "N,Admin,\\File01\admin"
  30.  
  31. DRIVE_ARRAY=split(DRIVE_ARRAY,"|")
  32. for ii=0 to ubound(DRIVE_ARRAY)
  33.  DRIVE_ARRAY(ii)=split(DRIVE_ARRAY(ii),",")
  34. next
  35.  
  36. if instr(GROUPS,"visitors") then MapDrives("IR")
  37. if instr(GROUPS,"wgs-allstudents") then MapDrives("IRH")
  38. if instr(GROUPS,"wgs-allstaff") then MapDrives("IRSTH")
  39. if instr(GROUPS,"admins") then MapDrives("IRSTN")
  40. 'if instr(GROUPS,"class") then
  41. ' ROOMNUMBER=mid(GROUPS,instr(GROUPS,"room")+4,2)
  42. ' ROOMPATH="\\File01\data$\student\user\Room "&ROOMNUMBER&"\!Class Folder"
  43. ' if FSO.folderexists(ROOMPATH) then
  44. '  NETWORK.mapnetworkdrive "M:",ROOMPATH
  45. '  SHELLAP.namespace("M:").self.name="Room "&ROOMNUMBER
  46. ' end if
  47. 'end if
  48.  
  49. sub MapDrives(DRIVE_STRING)
  50.  for ii=1 to len(DRIVE_STRING)
  51.   LETTER=mid(DRIVE_STRING,ii,1)
  52.   for each DRIVE_INFO in DRIVE_ARRAY
  53.    if instr(DRIVE_INFO(0),LETTER) then
  54.     NETWORK.mapnetworkdrive DRIVE_INFO(0)&":",DRIVE_INFO(2)
  55.     SHELLAP.namespace(DRIVE_INFO(0)&":").self.name=DRIVE_INFO(1)
  56.     exit for
  57.    end if
  58.   next
  59.  next
  60. end sub
  61.  
  62.  

Replies to Pines Login - in progress rss

Title Name Language When
Pines Login Chartreuse Pheasant vb 5 Years ago.