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 ...
-
9th December 2011, 12:45 PM #1
- 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
-
-
IDG Tech News
-
9th December 2011, 01:18 PM #2 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 01:38 PM.
-
-
9th December 2011, 01:27 PM #3 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"
-
-
9th December 2011, 01:33 PM #4 Shameless plug! The info you need is over on my blog. Thats exactly how it is set up with us.
-
-
9th December 2011, 04:54 PM #5
- Rep Power
- 0

Originally Posted by
TheScarfedOne
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
-
-
9th December 2011, 04:54 PM #6
- Rep Power
- 0
Hi mate, then thin clients are running Windows XP Embedded.
Cheers
-
SHARE:
Similar Threads
-
By rjm in forum Enterprise Software
Replies: 5
Last Post: 21st October 2011, 12:43 PM
-
By randle in forum Windows
Replies: 19
Last Post: 20th June 2011, 09:46 AM
-
By Heggy in forum Windows
Replies: 4
Last Post: 25th September 2009, 09:21 PM
-
By adamf in forum Windows
Replies: 4
Last Post: 7th August 2009, 07:37 AM
-
By jmair in forum Windows
Replies: 3
Last Post: 29th October 2008, 09: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
-
Forum Rules