Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Greeting, I have about 20 PCs with windows 7 home edition and I want users when turn on these PCs have only one option to connect to the server using remote desktop connection.

I wrote a power-shell script and placed it in start up folder to lunch it when windows started up.

simply the script has two lines:

 taskkill /F /IM explorer.exe
 Start "C:\rdp.rdp"

With this script user will have only remote desktop program running and they can connect to the server. The problem I'm facing that when user log off from the server the session will end and the remote desktop connection will closed and nothing will be in the background just empty desktop.

Is there a way to re-run remote desktop after a user log off from the server?

Note:You can not join windows 7 home premium to a domain and it does not have Group Policy option.

Regards,

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Something as simple as this should work:

taskkill /F /IM explorer.exe
:loop
Start /WAIT "C:\rdp.rdp"
goto loop

MSTSC (the RDP client) generally terminates itself when the user logs off. So, you use start /wait to start the program and wait for it to quit, then just launch it again. Note that you might need to start something like "mstsc C:\rdp.rdp" in order for this to work, check out the MSTSC help if what I have doesn't work.

share|improve this answer
    
Thank you for your hint This is the code I used:$i =0 While ($i -le 1) {# get a handle for the Notepad process to wait for $rdp = [System.Diagnostics.Process]::Start( "rdp.rdp" ) # wait indefinitely... $rdp.WaitForExit() Start rdp.rdp} –  Eyla Dec 23 '11 at 16:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.