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.



Something as simple as this should work:

taskkill /F /IM explorer.exe
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.

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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