Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Killing or launching a process remotely

Killing or launching a process remotely

Scheduled Pinned Locked Moved C#
sysadminhelptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    InvalidTypecast
    wrote on last edited by
    #1

    So I am able to successfully enumerate the processes on a machine using the remote machine's name on the network such as: Process[] myProcesses = Process.GetProcesses("Machine_Name_Here"); However, I'd like to also use myProcesses[0].Kill() for example to kill the process and then after use something like Process.Start("blah") to start it again. The problem I am running into is that Process.Kill is not supported on remote machines. Additionally, I am not sure if I am able to launch the process through Process.Start either. Is there anything I can do for this desired functionality?

    D 1 Reply Last reply
    0
    • I InvalidTypecast

      So I am able to successfully enumerate the processes on a machine using the remote machine's name on the network such as: Process[] myProcesses = Process.GetProcesses("Machine_Name_Here"); However, I'd like to also use myProcesses[0].Kill() for example to kill the process and then after use something like Process.Start("blah") to start it again. The problem I am running into is that Process.Kill is not supported on remote machines. Additionally, I am not sure if I am able to launch the process through Process.Start either. Is there anything I can do for this desired functionality?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      InvalidTypecast wrote:

      The problem I am running into is that Process.Kill is not supported on remote machines. Additionally, I am not sure if I am able to launch the process through Process.Start either.

      Neither is starting a remote process, for the obvious security implications. You can start a NON-INTERACTIVE process remotely using the WMI Win32_Process class. But, again, the user will NOT see any indication that the process is running. It will not be allowed to put up ANY user interface at all.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      I 1 Reply Last reply
      0
      • D Dave Kreskowiak

        InvalidTypecast wrote:

        The problem I am running into is that Process.Kill is not supported on remote machines. Additionally, I am not sure if I am able to launch the process through Process.Start either.

        Neither is starting a remote process, for the obvious security implications. You can start a NON-INTERACTIVE process remotely using the WMI Win32_Process class. But, again, the user will NOT see any indication that the process is running. It will not be allowed to put up ANY user interface at all.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        I Offline
        I Offline
        InvalidTypecast
        wrote on last edited by
        #3

        Yes, these are just command line applications with no interactivity that I need to restart essentially. Do you know of an article that provides a noobie example on using WMI for this?

        G D 2 Replies Last reply
        0
        • I InvalidTypecast

          Yes, these are just command line applications with no interactivity that I need to restart essentially. Do you know of an article that provides a noobie example on using WMI for this?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Not specifically for the Win32_Process class, but if you Google "C# WMI invoke method", you'll get something like this[^]. You can find the docs on the Win32_Process class here[^]. You're looking for the Create and Terminate methods.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          • I InvalidTypecast

            Yes, these are just command line applications with no interactivity that I need to restart essentially. Do you know of an article that provides a noobie example on using WMI for this?

            G Offline
            G Offline
            Giorgi Dalakishvili
            wrote on last edited by
            #5

            Did you try searching for the keywords? (WMI, win32_process_ A quick search returned these results: Howto: (Almost) Everything In WMI via C# Part 2: Processes[^] Windows Management Instrumentation (WMI) Implementation[^]

            #region signature my articles #endregion

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups