Connecting to Windows7 professional using MSTSC

I have a rdp file, that contains user name and password as well as an alternate shell. For my test case the alternate shell is a batch file that calls notepad and waits until notepad exits. Then it logs me out. This works perfectly when connecting to a Windows Server 2003 SP1 Enterprise Edition. I modified the full address parameter to point to a Windows 7 Professional and it logs in successfully to the machine, but does not run the alternate shell (my batch script). If I call the batch script, it works as expected. What's the issue here?

I am connecting from a Windows XP SP3 with Remote Desctop Connection Version 6.17600
cmntAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
Sorry, I was mislead by memory. You can remotely execute query session/reset session, even without setting the above reg entry (at least while in the same domain).

The whole requires you to execute the following before RDPing into the machine:
for /F "tokens=3" %%S in ('qwinsta /server:W7PC ^| find /i "active"') do reset session /server:W7PC %%S
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
The feature to provide an alternative shell is (AFAIK) only available on server, not client OS. Since W7 is a client OS, that will not work.
0
 
brd24gorConnect With a Mentor Commented:
This is a known bug in Windows 7. The remote server needs to have Terminal Services installed for remote execution to work.

http://social.technet.microsoft.com/Forums/en-US/winserverTS/thread/2b55ff33-3706-44e4-88a6-19c0b140cd25
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
cmntAuthor Commented:
@brd24gor:
Your link gave me a good idea. That I am testing right now. Using scheduled tasks should enable me to solve my problem. I need to run automated UI tests and therefore need to use the terminal server (otherwise the UI components are not available to the test software. The win7 scheduled tasks offer a lot of options, so that I am (theoretically) able to run a program when a specific user logs on.

I will hopefully know if it works in an hour.
0
 
brd24gorCommented:
Good deal! Let us know how it works out.
0
 
cmntAuthor Commented:
In General the solution works. I encountered a different issue now. It used to be, that there are two rdp licenses per server (so two people can connect at the same time). Can someone confirm that there is either only one remote session available or that there is indeed two sessions possible for a desktop OS (Windows 7 Professional)?

Is there a way to force a connection?  I get the following screenshot and it will disconnect me if I don't press 'yes'. However, the whole process should run automated without human intervention. Any Ideas?

 screenshot for disconnect user message
0
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
MS Licensing requires that you only can use one "interactive" session at any time on a MS client OS. So any other session needs to be "disconnected" - the session exists, but cannot be used without connecting the latter one again.
0
 
cmntAuthor Commented:
So questions for the number of interactive sessions is satisfactorily answered. How about an option to force the connection to be established. Is there a corresponding entry in the rdp file or am I forced to use qwinsta and rwinsta? The first option is preferred because less scripting is required for this.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
There is no logout enforcement option.
The issue with qwinsta/rwinsta is that you need to be logged in to use them.
0
 
cmntAuthor Commented:
Not sure what you mean by "you need to be logged in to use them"? I used them successfully with server OSs (Win2003 enterprise edition). Isn't there a way to enable them to run from remote?

I found an article that mentioned that I need to set
HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\AllowRemoteRPC
to 1

see http://www.codesoil.net/2007/08/16/big-problem-access-denied-when-using-qwinstaexe-or-wtsopenserver-api/

I am not sure if that will apply to my case as well (win7 prof). I am actually not the owner of the target machine and not an administrator. So I am a little bit limited for using the trial and error strategy. :(
0
 
cmntAuthor Commented:
When I run

qwinsta /server:W7PC

Open in new window


I get following error Message:

Error opening Terminal server nettechrobot
Error [1722]:The RPC server is unavailable.

Open in new window


What troubles me, that I can access the
\\W7PC\C$

Open in new window

. When I run
net use \\W7PC

Open in new window

I get the following print out:

Status       Local     Remote                    Network

-------------------------------------------------------------------------------
...
OK                     \\W7PC\IPC$       Microsoft Windows Network
The command completed successfully.

Open in new window


And I can connect to the server using mstsc using the account that I am logged in with locally.

Any Idea to solve this issue??
0
 
cmntAuthor Commented:
Update: I missed that HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\AllowRemoteRPC was actually defined. Unfortunately to 0. I changed it to 1 and now I can run qwinsta from a different machine. Therefore, ...

Ignore my last comment.
0
 
cmntConnect With a Mentor Author Commented:
Great it works now. I had to change the command provided to Qlemo to

for /F "tokens=3" %%S in ('qwinsta /server:W7PC ^| find /i "active"') do rwinsta /server:W7PC %%S

Open in new window


The problem was, that on my test command prompt the reset command acted goofy which caused the for-loop to call itself and never actually resetting the terminal server session. rwinsta in contrast worked without issues.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Note:
query session is the same as qwinsta
reset session is the same as rwinsta
0
 
cmntAuthor Commented:
@Qlemo:

I think you are right with what you said. However, for some reason I got the expected result only with rwinsta and not with reset sessions.

It took me 30 minutes to figure that out. It might have been a problem with my console window or a general problem. I didn't try to figure out if that was a permanent problem or not. I already spent too much time on the original task. :(
0
 
cmntAuthor Commented:
Added my own comment, to provide the command line that worked for me.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.