Learn how to a build a cloud-first strategyRegister Now


PSExec only starts a Process, no window visible

Posted on 2011-05-08
Medium Priority
Last Modified: 2013-11-05
I got two Applications (Delphi Programs). App A runs  on a Terminal-Server (same behaviour in normal RDP-Session). Now the Problem: App B should do its work on the Local machine, where the Ts-Session is started. The Server should only get a result after work is done. But it is important that B can be started with a button in A.

I tried out ShellexecuteAndWait with PSExec to start B on the local machine. It worked, but I only get a process. App B is interactive, so I must see the GUI, but there is no window visible. What can i do? Is there a better way with DCOM, some one got an example then? Jus a Link to how it is solved would be great, i cannot imagine the search words to find a fitting solution.

yes, i use -i as param!!!

Huge Thx for helping me!
Question by:migross
  • 4
  • 3
  • 2
  • +2
LVL 11

Expert Comment

ID: 35715839
Don't know much about Delphi programming but did you check under whose priviledges it runs? Maybe it starts as another user and thus you're not seeing the results.
And I was supposed to write abnout -i switch ;)
LVL 25

Expert Comment

ID: 35716590
hum. I was just thinking this :

What if appB is only launching another exe, let's call it appC (which would be in fact your current appB) with ShellExecute

ShellExecute( nil ,'open',PChar('c:\test.exe'),nil,nil,SW_SHOWNORMAL)

it would then show the appC exactly as if a user started it in explorer

Then I looked in PsExec documentation, and maybe the problem is only that the app does not run in the good session (pretty much what marek is hinting about, but you have to know PsExec to understand it). So yes, probably you didn't used the "-i" switch correctly, with a user session name.
And no, most probably my first thought would not work, as the appC would run under the same condition as appB, so it would not show either under the user session.
LVL 38

Expert Comment

by:Geert Gruwez
ID: 35718245
you want to start a exe from inside the RDP session on the local machine (not on the server) ?

then you need to remotely start the app from the server on your local machine
this assumes that the user running the RDP session is the same as the user currently running on the local machine

unless you need info from the local machine, you could also let the app run in the rdp session
Industry Leaders: 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!


Author Comment

ID: 35718660
Yes, on the local machine.

It's important to let it run on the local machine, because sometimes the ts-connection is too slow when mobile connected (if 3g is not available and only GPRS). And then the mouse-sensitivity is too bad to do its work correctly. For this reason the program should be started local and not on TS.

Even increasing the mouse in the registy was not enough for slow connections.
 [HKEY_CURENT_USER \ Software \ Microsoft \ Terminal Server Client]
 Min Send Interval = 10

So I thougt i must start it local.

if i try this in my Shellexecute

PSExec \\mx1 -u user -p pass -i c:\DoIt.exe

the Process starts, PSEXEC waits til Process has ended. All great, but the Doit.exe does not show the window for interacting with the user...only the process is in the process list in the taskmanager.

It's the same user who is logged in in Windows.

LVL 25

Expert Comment

ID: 35719098
in the task manager, does your process shows with your username ?
can you try the trick I told you about (lanching with RDP another app that only calls the good one with ShellExecute)
LVL 25

Expert Comment

ID: 35720913
Hi !

I've been playing around with PSExec (first time for everything), and at first had the same problem until I found this clue :

The -i switch must be entered on the psexec commandline before myapp.exe, else it will not be interpreted by psexec, but passed to myapp.exe as its command line argument.

Guess What ! It WORKS
LVL 11

Expert Comment

ID: 35722902
epasquier - but the TC did this already. Look at his latest post.
LVL 15

Expert Comment

ID: 35723130
Are you trying to get a interactive process on the remote machine? Also is the remote machine Vista/W7? If so you wont see a GUI in interactive mode due to new security measure implemented in these versions. Added to help fight malware especially for businesses that are Networked. The process itself has the GUI, but it will be shown in a virtual sandbox system separate from the account your trying to get a interactive GUI from. Best way is to activate it from the remote account ad it your running it locally if your using TS and click 'Ok' on the UAC prompt.
LVL 25

Accepted Solution

epasquier earned 1500 total points
ID: 35743095
Also is the remote machine Vista/W7? If so you wont see a GUI in interactive mode due to new security measure implemented in these versions.

Probably not exact, but I concur to the fact it is not a good idea to go in that line of work.

I explain : I managed from a VM running XP to launch a process on Seven, and have the GUI on the seven host. So it is not impossible. BUT
a) It took me almost an hour to play around with my security parameters, shutting down firewalls, antivirus, security profiles on Seven, reinitialized "net use" on XP to circumvent some caching of access rights or something...
b) then it worked, mostly because my first successful attempt was with -i parameter changing place, and I started re-enabling security step by step, and it was still working when I posted my last message
c) but later, without having changed anything more in my system, and I saw that maybe your problem was not the -i parameter (as marek pointed), I retested and it wasn't working anymore : probably something in the security took some time to be active again. I don't know really, and after another hour I gave up without being able to reproduce the first success.

Even if there is a way, I would not brand it as reliable solution. And yes, the fact that it was indeed possible in the past is scary for security, so I'd rather say Thank You to MS for those upgrades in security.

Probably you should think of another way to do what you need. For example : run an application in your local machine, that opens a TCP/IP port for listening, and waits a signal from your other app. Then it can show the form, do whatever the user need to do, and send back the result to the caller, all through TCP/IP. Much more standard and secure way IMO

Author Comment

ID: 35744117
Well, I will not try to use PSExec for that function anymore. TCP-IP could be a solution, but then the local program must run resident. That is not so cool, but perhaps a way to solve my problem.

Starting with DCOM would be same Security-Probs as PSExec, right?

Big Thx for all who thought about my problem. I will close this request now.

Author Closing Comment

ID: 35744127
That was a very special problem, thx again for bringing my on the right way, the PSExec was a Dead End this time.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Know what services you can and cannot, should and should not combine on your server.
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…
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…
Suggested Courses
Course of the Month21 days, 6 hours left to enroll

810 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