Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am writing a program that is used as a RemoteApp from server to the client machine.

I know that using System.Windows.Forms.SystemInformation.TerminalServerSession I can determine if the current session is a local session or a remote session from RemoteApp execution.

Is there a way for me, if Terminal Server Session is true (when user is running the app remotely), to tell the local machine to execute an application, like MS Word? I'd like do it natively, without use of plug-ins or psexec if it can be helped.

share|improve this question
    
tricerat.com/blog/166 –  STTR May 15 '13 at 20:39
    
@STTR Relevance? –  Bob. May 15 '13 at 20:43
add comment

1 Answer

you have 4 options with varying degrees of complexity, reliability, and deployment considerations.

1) PSEXEC. seriously, lots of people use psexec for this purpose, and works most of the time. by far the simplest solution. use -i so it can interact with the desktop.

2) WMI. you can write .net or VBScript code to execute the client app. its just as scripty as psexec, but is entirely native. I've had reliability problems with WMI before, but those were domain wide automated ops, and much of the issue appeared to be power management on idle workstations. http://www.codeproject.com/Articles/31113/Create-a-Remote-Process-using-WMI-in-C

3) Windows task scheduler. from the server schedule a task to execute on the client in the users session. still scripty, with lots of moving parts. http://technet.microsoft.com/en-us/library/cc772785%28v=ws.10%29.aspx

4)create a windows network service for the local PC, and upon signal, launch the task under the users session. you may have to use the task scheduler to accomplish this. lots of work to dev and test, hard to deploy, lots of moving parts, and still scripty in places, but this would probably be microsofts answer, as it correctly implements their guidance for process elevation.

share|improve this answer
    
So with PSEXEC, I'd be remoting from the client machine to the client machine from the RemoteApp to execute an application? –  Bob. May 16 '13 at 1:28
    
yes. more or less. the actual execution of the RemoteApp is occurring on the server, which is why you can't just do a Process.Start(path); the winword process would start on the server. so its more precise to say that the client is connecting to the server to get the output of the remote app, and the server is connecting to the client to run the local one. PSexec would be placed on the server where the remoteapp can call it. –  Frank Thomas May 16 '13 at 1:57
    
I was hoping there was a way I could use the Environment variables in C# to do it, since using PSEXEC would mean the client would need to authorize more stuff to be added to their server. –  Bob. May 16 '13 at 2:09
    
Its not about environment config per se, though I suspect path variables from the remoteApps environment would resolve to server-side paths. Besides even if you got the path on the client, if the remoteapp process executed it, it would still be running on the server, not the client. just drop psexec in the bin directory as a dependency, or look at the taskscheduler/wmi methods. –  Frank Thomas May 16 '13 at 2:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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