Results 1 to 7 of 7

Thread: Client name terminal server

  1. #1
    Foolke Guest

    Client name terminal server

    Our environment is working with terminal services.
    Does anybody have an example of a vbs that I can run on the client and on
    the server to see the client name (or Ip adres) of the computer that is
    connected to the terminal server

  2. #2
    Pegasus \(MVP\) Guest

    Re: Client name terminal server

    You could use the Terminal Services Manager. You'll find
    it under the server's Admin Tools.

  3. #3
    Shay Levi Guest
    See if this helps:

    http://dev.remotenetworktechnology.c.../lib/tslib.htm

    Terminal Services Manager is showing me the info I need but i want this info
    from a script. Need this to help me map printers when a user logs in on an
    other PC.

  4. #4
    Foolke Guest
    Thx but in the script :
    >> Set Sh = CreateObject("WScript.Shell")
    >> sys = Sh.ExpandEnvironmentStrings("%CLIENTNAME%")


    the %CLIENTNAME% is showing the client name from where the user logged on to
    the session, not the client where the user is connected from. Example: log on
    from PC1, disconnect, reconnect from PC2. %CLIENTNAME% is showing PC1

  5. #5
    Shay Levi Guest
    Try query.exe (on the TS server):

    C:\>query

    Invalid parameter(s)
    QUERY { FARM | PROCESS | SERVER | SESSION | TERMSERVER | USER }

    C:\>query session


    SESSIONNAME USERNAME ID STATE TYPE DEVICE
    console administrator 0 Active wdcon
    rdp-tcp 65536 Listen rdpwd
    ica-tcp 65537 Listen wdica
    ica-tcp#412 user2 6 Active wdica
    ica-tcp#464 user3 15 Active wdica
    ica-tcp#475 user4 21 Active wdica
    ica-tcp#528 user5 2 Active wdica
    ica-tcp#531 user6 4 Active wdica
    ica-tcp#537 user7 3 Active wdica
    ica-tcp#542 user8 9 Active wdica
    ica-tcp#545 user9 1 Active wdica
    ica-tcp#546 user10 8 Active wdica
    ica-tcp#547 user11 11 Active wdica
    >rdp-tcp#548 administrator 12 Active rdpwd


    how about :/>net session

    Try "query.exe session".

  6. #6
    Join Date
    Jul 2008
    Posts
    1

    Map client printers based on TS client name

    This script will read the 4 leftmost characters of the clientname and maps a printer that matches the leftmost characters of the printername. Notice I used a "13" in the mid string for the printername because the UNC \\spooler01 is 13 characters long you will have to adjust this value based on your names. It will also log an event.

    PS. If you get up and change locations and disconnect without logging off the session, when you sit down at the new location it will not remap printers you must logoff and log back in to work.

    Dim LeftString, netPrinter, UNCpath, Midstring
    Set Sh = CreateObject("WScript.Shell")
    sys = Sh.ExpandEnvironmentStrings("%CLIENTNAME%")
    User = CreateObject("WScript.Network").Username
    Sh.LogEvent 4, "Logon by " & User & " from " & sys
    LeftString = Left(sys, 4)
    WScript.echo leftstring
    if leftstring = "yourclientcomputersname" then
    UNCpath = "\\spooler01\theprinteryouwanttomap"
    Set netPrinter = CreateObject("WScript.Network")
    netPrinter.AddWindowsPrinterConnection UNCpath
    WScript.Echo "Your printer is mapped from : " & UNCpath
    end if
    Midstring = Mid(UNCpath,13,4)
    Wscript.echo Midstring
    Wscript.echo "If you have changed location since starting this session Please Logoff and Logon again for correct devices and printers"
    WScript.Quit

    replace yourclientcomputersname with the client name you want to map the corresponding printer
    replace \\spooler01\theprinteryouwanttomap with the UNC of your spooler and printer.
    Remove all Wscript.echo commands if you dont want to see dialog boxes
    this will also log events for you look at your event viewer to see messages.
    Delete this paragraph when running this script.

  7. #7
    Join Date
    Jan 2010
    Posts
    2

    Re: Client name terminal server

    This looks like something that I can use in my login script to determine if the %computername% is from this office or another office I manage.
    The naming convention of the pc's start with the letters of the state.
    LA, SF, NY, SE, MO, TX, etc.
    How would I tweak it to read the computername and then determine based on the first 2 characters whether to continue the script or GOTOEND?

Similar Threads

  1. No Terminal Server Client access licenses available...Error
    By -Wamil- in forum Operating Systems
    Replies: 5
    Last Post: 19-10-2010, 06:50 AM
  2. Replies: 5
    Last Post: 22-08-2010, 02:39 AM
  3. Replies: 3
    Last Post: 13-03-2009, 05:12 PM
  4. Linux Terminal Client
    By Greger in forum Operating Systems
    Replies: 2
    Last Post: 16-02-2009, 03:22 PM
  5. RWW - Terminal Services Active X Web Client
    By iShree in forum Small Business Server
    Replies: 3
    Last Post: 09-08-2007, 11:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,671,657.92022 seconds with 17 queries