Solved

Connecting to Windows7 professional using MSTSC

Posted on 2011-02-21
16
1,194 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:cmnt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 2
16 Comments
 
LVL 70

Expert Comment

by:Qlemo
ID: 34946941
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
 
LVL 3

Assisted Solution

by:brd24gor
brd24gor earned 150 total points
ID: 34947031
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
 

Author Comment

by:cmnt
ID: 34951602
@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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 3

Expert Comment

by:brd24gor
ID: 34951717
Good deal! Let us know how it works out.
0
 

Author Comment

by:cmnt
ID: 34953246
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
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 350 total points
ID: 34953414
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
 

Author Comment

by:cmnt
ID: 34953577
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
 
LVL 70

Expert Comment

by:Qlemo
ID: 34953609
There is no logout enforcement option.
The issue with qwinsta/rwinsta is that you need to be logged in to use them.
0
 

Author Comment

by:cmnt
ID: 34953759
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
 
LVL 70

Accepted Solution

by:
Qlemo earned 350 total points
ID: 34953891
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
 

Author Comment

by:cmnt
ID: 34954015
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
 

Author Comment

by:cmnt
ID: 34954228
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
 

Assisted Solution

by:cmnt
cmnt earned 0 total points
ID: 34955347
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
 
LVL 70

Expert Comment

by:Qlemo
ID: 34956436
Note:
query session is the same as qwinsta
reset session is the same as rwinsta
0
 

Author Comment

by:cmnt
ID: 34984646
@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
 

Author Closing Comment

by:cmnt
ID: 34990849
Added my own comment, to provide the command line that worked for me.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
At the beginning of the year, the IT world was taken hostage by the shareholders of LogMeIn. Their free product, which had been free for ten years, all of the sudden became a "pay" product. Now, I am the first person who will say that software maker…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question