Hi,

I'm trying to create a script that will lookup the SAM ID and link it to the users distinguished name in Active Directory. The script will then allow to modify the selected users profile path in AD.

This is the code that I've got so far.

VB Code:
  1. Const Enabled = 1
  2. Const Disabled = 0
  3. Const ForReading = 1
  4. Dim User
  5.  
  6. Set oFSO = CreateObject("Scripting.FileSystemObject")
  7. Set oWriteFile = oFSO.CreateTextFile("TSM.csv", true)
  8. Set oRefFile = oFSO.OpenTextFile("user.ref", ForReading)
  9.  
  10. Do Until oRefFile.AtEndOfStream
  11.     strNextLine = oRefFile.Readline
  12.     arrUserList = Split(strNextLine , "")
  13.     For i = 0 to Ubound(arrUserList)
  14.     User = arrUserList(i)
  15.     User = Replace(User,"""","" )
  16.     TSMOD(User)
  17.     Next
  18.     Loop
  19. Wscript.echo "Done"
  20.  
  21. Sub TSMOD(User)
  22.  
  23. Set objUser = GetObject _
  24.     ("LDAP://" & User)
  25.  
  26. objUser.TerminalServicesProfilePath = "%profloc%\<insert username here>\%wtsprofile"
  27. objUser.AllowLogon = Enabled
  28. objUser.SetInfo
  29.  
  30. End Sub

Any help will be appreciated.

Regards,

Ruaan