Solved

Connecting to Windows7 professional using MSTSC

Posted on 2011-02-21
16
1,191 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
  • 9
  • 5
  • 2
16 Comments
 
LVL 69

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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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 69

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 69

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 69

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 69

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now