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. get service or process

get service or process

Scheduled Pinned Locked Moved C#
tutorialquestion
9 Posts 4 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.
  • G Offline
    G Offline
    George_George
    wrote on last edited by
    #1

    Hello everyone, If I have enough priveleges, how could I get and access the services on a remote computer if I know the remote computer machine name? For example, I want to enumerate all the services on a remote computer and stop a service if its name matches some rules? thanks in advance, George

    N U T 3 Replies Last reply
    0
    • G George_George

      Hello everyone, If I have enough priveleges, how could I get and access the services on a remote computer if I know the remote computer machine name? For example, I want to enumerate all the services on a remote computer and stop a service if its name matches some rules? thanks in advance, George

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Process.GetProcesses(machineName)[^] gives a list of processes running on the specified machine. For authenticating remote machine, I think you should impersonate the user as Process.GetProcesses is not allowing to supply any user credentials.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      G 1 Reply Last reply
      0
      • N N a v a n e e t h

        Process.GetProcesses(machineName)[^] gives a list of processes running on the specified machine. For authenticating remote machine, I think you should impersonate the user as Process.GetProcesses is not allowing to supply any user credentials.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        G Offline
        G Offline
        George_George
        wrote on last edited by
        #3

        What means "impersonate the user as Process.GetProcesses is not allowing to supply any user credentials."? I read a couple of times but do not know what you mean. Could you say in some other words please? :-) regards, George

        N 1 Reply Last reply
        0
        • G George_George

          What means "impersonate the user as Process.GetProcesses is not allowing to supply any user credentials."? I read a couple of times but do not know what you mean. Could you say in some other words please? :-) regards, George

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Process.GetProcesses is not allowing to supply user credentials for the remote machine. So you need to use some impersonation techniques to authenticate the remote machine. I haven't used but I think WindowsImpersonationContext[^] class can be used for this.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          G 1 Reply Last reply
          0
          • G George_George

            Hello everyone, If I have enough priveleges, how could I get and access the services on a remote computer if I know the remote computer machine name? For example, I want to enumerate all the services on a remote computer and stop a service if its name matches some rules? thanks in advance, George

            U Offline
            U Offline
            Uros Calakovic
            wrote on last edited by
            #5

            WMI is capable of doing that.[^]

            Don't happy, be worry.

            G 1 Reply Last reply
            0
            • U Uros Calakovic

              WMI is capable of doing that.[^]

              Don't happy, be worry.

              G Offline
              G Offline
              George_George
              wrote on last edited by
              #6

              Cool, Uros! regards, George

              1 Reply Last reply
              0
              • G George_George

                Hello everyone, If I have enough priveleges, how could I get and access the services on a remote computer if I know the remote computer machine name? For example, I want to enumerate all the services on a remote computer and stop a service if its name matches some rules? thanks in advance, George

                T Offline
                T Offline
                Tom John
                wrote on last edited by
                #7

                Have a look at the ServiceController class, there's even an example to do what you're asking on MSDN: http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx[^] Hope this helps Tom

                G 1 Reply Last reply
                0
                • T Tom John

                  Have a look at the ServiceController class, there's even an example to do what you're asking on MSDN: http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx[^] Hope this helps Tom

                  G Offline
                  G Offline
                  George_George
                  wrote on last edited by
                  #8

                  Thanks Tom, The link your provided is very helpful. After reading it, I am confused about what means "This would be useful, because the Service Control Manager (SCM) Microsoft Management Console snap-in does not support custom commands." -- custom commands means? Could you show me an example please? regards, George

                  1 Reply Last reply
                  0
                  • N N a v a n e e t h

                    Process.GetProcesses is not allowing to supply user credentials for the remote machine. So you need to use some impersonation techniques to authenticate the remote machine. I haven't used but I think WindowsImpersonationContext[^] class can be used for this.

                    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                    G Offline
                    G Offline
                    George_George
                    wrote on last edited by
                    #9

                    Thanks N a v a n e e t h! I read the link but confused about what means "impersonation operation" or so-called impersonation technologies, does it a hacking technologies which someone acts (pretents) to be someone else? Could you clarify or provide some reference document about this technique please? regards, George

                    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