[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 518
  • Last Modified:

Start Application Remotely

Hey Experts, I'm trying to get an application that is installed on a remote computer to come up in the user's Window screen.   I've used the following code:

Private Sub ExecProg(ByVal ServerName As String, ByVal ProgramName As String)
        Dim process As Object
        Dim method As Object
        Dim inParam As Object
        Dim outParam As Object

        Dim processid As Long, result As Long

        process = GetObject("WinMgmts:{impersonationLevel=Impersonate, authenticationLevel=pktPrivacy}\\" & ServerName & "\root\cimv2:Win32_Process")

        method = process.Methods_("Create")
        inParam = method.inParameters.SpawnInstance_()
        inParam.CommandLine = ProgramName
        outParam = process.ExecMethod_("Create", inParam)

        If outParam.returnValue = 0 Then
            MsgBox("Method executed successfully")
        Else
            MsgBox("Method failed")
        End If
    End Sub

Which works and gets the program to show up in the processes as running, but the program does not execute on the screen.  What can I do to get the program to "pop up" on the users screen?
0
carmodyk
Asked:
carmodyk
  • 2
  • 2
1 Solution
 
andrewharrisCommented:
Firstly, I am not sure this is possible but I will look a little deeper.

In the mean time, who is the process starting as? on the remote machine, check task manager for the user column on the processes tab.

Will see what else I can dig up.

Andrew
0
 
andrewharrisCommented:
This is what I was worried about: http://www.dotnet247.com/247reference/msgs/36/181408.aspx

I honestly dont thnk it is posible using WMI.

Andrew
0
 
carmodykAuthor Commented:
Thanks for the link Andrew,  however it did state that as long as the program can interact with the desktop it can be done.  I have access to the remote computer and I could set the programm to interact with the desktop, but how?
0
 
carmodykAuthor Commented:
Ding!  Found the answer:

I would have to look in terminal services manager for user applications running.

And then to get the interact with desktop function running you have to modify the program to run as a service. In management tools/services. service "Logon" will allow you set how this program behaves.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now