Syntax for adding terminal service profile entry into an existing user

Posted on 2005-04-22
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
    LVL 14

    Expert Comment

    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

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

    Expert Comment

    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%"

    Author Comment

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

    LVL 82

    Accepted Solution


    Author Comment

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

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
    Learn about cloud computing and its benefits for small business owners.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now