Changing the user profile attribute in Active Directory
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:
Const Enabled = 1
Const Disabled = 0
Const ForReading = 1
Dim User
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oWriteFile = oFSO.CreateTextFile("TSM.csv", true)
Set oRefFile = oFSO.OpenTextFile("user.ref", ForReading)
Do Until oRefFile.AtEndOfStream
strNextLine = oRefFile.Readline
arrUserList = Split(strNextLine , "")
For i = 0 to Ubound(arrUserList)
User = arrUserList(i)
User = Replace(User,"""","" )
TSMOD(User)
Next
Loop
Wscript.echo "Done"
Sub TSMOD(User)
Set objUser = GetObject _
("LDAP://" & User)
objUser.TerminalServicesProfilePath = "%profloc%\<insert username here>\%wtsprofile"
objUser.AllowLogon = Enabled
objUser.SetInfo
End Sub
Any help will be appreciated.
Regards,
Ruaan