Syntax for adding terminal service profile entry into an existing user

I have 200 users that need a Terminal Service Profile entry for the profile and home directories. with say a entry of \\servername\share\%username% for the home directory I will also need to allocate a drive letter and it must resolve the %username% to the actual user name.

Can anyone help with the syntax entries, scripts, batch files. The users are located in different OU.

Who is Participating?
oBdAConnect With a Mentor Commented:
Dim objNet, strUserName

Set objNet = CreateObject("Wscript.Network")

'strUserName =objNet.UserName

'objNet.MapNetworkDrive "H:", "\\server\share\" & strUserName

this is a vbs script which will map a \\server\share\username to a H: drive
just copy and save it as a script.vbs

2ndsiteAuthor Commented:
Sorry it's not drive mapping I want ... it is the terminal settings within the user that I want to populate
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Microsoft's support for scripting a user's terminal server properties has always been weak. You can download SomarSoft's tscmd.exe in the "Free Tools" section at and use this to change the user's properties.
Assuming you have a list of users to be changed, this script should do the trick; just change the file paths, names, server names, and share name. The script is currently in test mode, it will only write the commands it would run into the log file. Remove the "ECHO"s in front of the tscmd command to run it for real.
Try it with a list of test users first.

@echo off
set UserFile=C:\Temp\test.txt
set LogFile=C:\Temp\test.log
set DC=SomeDC
for /f "delims=" %%a in ('type "%UserFile%"') do (
  echo Processing %%a ...
  >>"%LogFile%" echo ********** %%a **********
  ECHO tscmd.exe %DC% "%%a" TerminalServerHomeDirDrive H: >>"%LogFile%"
  ECHO tscmd.exe %DC% "%%a" TerminalServerHomeDir "\\Servername\share\%%a" >>"%LogFile%"
2ndsiteAuthor Commented:
To add the profile path for Terminal service would this be
TerminalServerProfilepath ?

2ndsiteAuthor Commented:
Thanks for the info I'll try running the script etc ...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.