[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Syntax for adding terminal service profile entry into an existing user

Posted on 2005-04-22
Medium Priority
Last Modified: 2009-12-16
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.

Question by:2ndsite
  • 3
  • 2
LVL 14

Expert Comment

ID: 13841800
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


Author Comment

ID: 13842333
Sorry it's not drive mapping I want ... it is the terminal settings within the user that I want to populate
LVL 85

Expert Comment

ID: 13843750
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 http://www.somarsoft.com/ 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%"
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.


Author Comment

ID: 13857678
To add the profile path for Terminal service would this be
TerminalServerProfilepath ?

LVL 85

Accepted Solution

oBdA earned 1000 total points
ID: 13857729

Author Comment

ID: 13857872
Thanks for the info I'll try running the script etc ...

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question