Start Application Remotely

Posted on 2004-10-26
Last Modified: 2006-11-17
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")
            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?
Question by:carmodyk
    LVL 4

    Expert Comment

    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.

    LVL 4

    Accepted Solution

    This is what I was worried about:

    I honestly dont thnk it is posible using WMI.

    LVL 6

    Author Comment

    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?
    LVL 6

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    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…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    933 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

    14 Experts available now in Live!

    Get 1:1 Help Now