+ Post New Thread
Results 1 to 6 of 6
Thin Client and Virtual Machines Thread, Auto reconnect RDP Remote Desktop Connection to Terminal Server from Thin Client in Technical; Hi there, We are currently setting up several thin client PCs to connect to a new terminal server farm. To ...
  1. #1

    Join Date
    Dec 2011
    Location
    Sheffield
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Auto reconnect RDP Remote Desktop Connection to Terminal Server from Thin Client

    Hi there,

    We are currently setting up several thin client PCs to connect to a new terminal server farm. To automatically connect to the farm, I have created a Remote Desktop Connection and dropped it into Startup on each thin client. Therefore when the thin client is booted up, it automatically connects to the Terminal server farm. However, if a user closes their remote sessions or logs off, it then takes them back to the thin client desktop.

    My question is, if the remote desktop connection is closed/logged off, is there a way to automatically re-establish the remote desktop connection so the thin client then reconnects to the logon page on the ts farm?

    Any pointers would be a great help!

    Cheers Rich

  2. #2
    Bezwick's Avatar
    Join Date
    Feb 2008
    Location
    Nottinghamshire
    Posts
    358
    Thank Post
    93
    Thanked 57 Times in 43 Posts
    Rep Power
    25
    Simple answer is yes replace the explorer shell with a vb script which is looped.

    You havent said whnat OS you have on the thin clients, this will work for any version of xp, but wont work for Windows Thin PC.

    Create an rdp client file and with all the settings you need for accessing your terminal server and save it to

    c:\windows\system32\school.rdp

    then create a vb script like this one

    Option Explicit
    'On Error Resume Next

    Dim objShell

    Set objShell = CreateObject("WScript.Shell")

    Do
    If (objShell.AppActivate("Remote Desktop") = False) Then
    objShell.Run "mstsc.exe C:\WINDOWS\SYSTEM32\school.rdp"
    WScript.Sleep 4000
    Else
    WScript.Sleep 2000
    End If
    Loop

    and call it say remote.vbs and also save it to your windows\system32 folder.

    Now open the registry in

    HKCU\Software\microsoft\windows nt\current version\winlogon

    and create a string called "Shell"
    and set its value to "remote.vbs"

    Now when the system boots it should autostart your rdp connecting and reconnect when its closed.

    good luck
    Last edited by Bezwick; 9th December 2011 at 12:38 PM.

  3. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,092
    Thank Post
    891
    Thanked 1,742 Times in 1,502 Posts
    Blog Entries
    12
    Rep Power
    456
    This VBS script will work on Thin PC. You need to change the shell to this file. Make sure you put Wscript in front of it wont work

    for example wscript.exe C:\script.vbs

    Code:
    On Error Resume Next
    Set fs = CreateObject ("Scripting.FileSystemObject")
    Set WshShell = WScript.CreateObject ("WScript.Shell")
    
    'Get the username and profile directory
    MUser = WshShell.ExpandEnvironmentStrings ("%USERNAME%")
    MUserProfile = wshShell.ExpandEnvironmentStrings("%USERPROFILE%")
    
    'Delete icons
    fs.DeleteFolder MUserProfile & "\Start Menu\Programs\Accessories",True
    fs.DeleteFile  MUserProfile & "\Start Menu\Programs\*.lnk"
    
    'Run the app
    
    wshShell.Run "c:\myapp\app.exe"
    
    ' Connect to wmi
    set objWMIService = GetObject("winmgmts:root\cimv2")
    Do
      found = false
    ' List the processes
    strQuery = "Select * from win32_process where name='app.exe'"
    set colProcesses = objWMIService.ExecQuery(strQuery)
    
    for each proc in colProcesses
    
       ' Get the reference class linking processes to sessions to get the session object path
       strQuery = "References of {win32_process.handle='" & proc.handle & "'} where ResultClass=Win32_SessionProcess"
       set colSessionReferences = objWMIService.ExecQuery(strQuery)
    
       for each oSessionReference in colSessionReferences
          'Get associators of the session object that are user accounts (linked by win32_loggedonuser)
          strQuery = "Associators of {" & oSessionReference.antecedent & "} where AssocClass=win32_LoggedOnUser"
          set colUsers = objWMIService.ExecQuery(strQuery,,48)
            for each user in colUsers
             if user.name = MUser then found = true
          next
       next
    next
    Loop While found = true
    
    'Run the Windows 2003 logoff utility
    wshShell.Run "c:\windows\system32\logoff.exe"

  4. #4
    TheScarfedOne's Avatar
    Join Date
    Apr 2007
    Location
    Plymouth, Devon
    Posts
    1,155
    Thank Post
    683
    Thanked 169 Times in 154 Posts
    Blog Entries
    78
    Rep Power
    85
    Shameless plug! The info you need is over on my blog. Thats exactly how it is set up with us.

  5. #5

    Join Date
    Dec 2011
    Location
    Sheffield
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by TheScarfedOne View Post
    Shameless plug! The info you need is over on my blog. Thats exactly how it is set up with us.
    Hi mate, can you send me a link to the blog entry?

    Cheers

  6. #6

    Join Date
    Dec 2011
    Location
    Sheffield
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hi mate, then thin clients are running Windows XP Embedded.

    Cheers

SHARE:
+ Post New Thread

Similar Threads

  1. Remote Desktop connection to server problem
    By randle in forum Windows
    Replies: 21
    Last Post: 16th September 2013, 10:29 PM
  2. Remote Desktop Connection via TMG2010 to Windows 7 PC
    By rjm in forum Enterprise Software
    Replies: 5
    Last Post: 21st October 2011, 12:43 PM
  3. Replies: 4
    Last Post: 25th September 2009, 09:21 PM
  4. Script to connect to terminal server?
    By adamf in forum Windows
    Replies: 4
    Last Post: 7th August 2009, 07:37 AM
  5. Remote Desktop Connection to Server.
    By jmair in forum Windows
    Replies: 3
    Last Post: 29th October 2008, 08:09 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •