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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to run commands in command prompt in remote computer and save output in local file

how to run commands in command prompt in remote computer and save output in local file

Scheduled Pinned Locked Moved C#
tutorial
11 Posts 6 Posters 12 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.
  • S Offline
    S Offline
    superselector
    wrote on last edited by
    #1

    I want to run a command in remote computer command prompt and fetch command output of the remote computer and save the output in local system. i don't want to use WMI for this as wmi is not enabled in the remote computer.

    A P B J 4 Replies Last reply
    0
    • S superselector

      I want to run a command in remote computer command prompt and fetch command output of the remote computer and save the output in local system. i don't want to use WMI for this as wmi is not enabled in the remote computer.

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      WMI should help you achieve this task quite easily provided you have access to the remote machine. Try Create a Remote Process using WMI in C#[^] as a good sample.

      Apps - Color Analyzer | Arctic | XKCD | Sound Meter | Speed Dial

      S 1 Reply Last reply
      0
      • A Abhinav S

        WMI should help you achieve this task quite easily provided you have access to the remote machine. Try Create a Remote Process using WMI in C#[^] as a good sample.

        Apps - Color Analyzer | Arctic | XKCD | Sound Meter | Speed Dial

        S Offline
        S Offline
        superselector
        wrote on last edited by
        #3

        i have already mentioned wmi is not an option.

        A 2 Replies Last reply
        0
        • S superselector

          I want to run a command in remote computer command prompt and fetch command output of the remote computer and save the output in local system. i don't want to use WMI for this as wmi is not enabled in the remote computer.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          If I were you, I'd use PsExec[^] to execute the commands.

          S 1 Reply Last reply
          0
          • S superselector

            i have already mentioned wmi is not an option.

            A Offline
            A Offline
            Abhinav S
            wrote on last edited by
            #5

            If firewalls settings can be configured, try Running Any Command Line exe Remotely Using the Process Class[^].

            Apps - Color Analyzer | Arctic | XKCD | Sound Meter | Speed Dial

            1 Reply Last reply
            0
            • S superselector

              i have already mentioned wmi is not an option.

              A Offline
              A Offline
              Abhinav S
              wrote on last edited by
              #6

              If firewalls settings can be configured, try Running Any Command Line exe Remotely Using the Process Class[^]

              Apps - Color Analyzer | Arctic | XKCD | Sound Meter | Speed Dial

              1 Reply Last reply
              0
              • P Pete OHanlon

                If I were you, I'd use PsExec[^] to execute the commands.

                S Offline
                S Offline
                superselector
                wrote on last edited by
                #7

                can psexec work for machines not in domain.

                1 Reply Last reply
                0
                • S superselector

                  I want to run a command in remote computer command prompt and fetch command output of the remote computer and save the output in local system. i don't want to use WMI for this as wmi is not enabled in the remote computer.

                  B Offline
                  B Offline
                  Bernhard Hiller
                  wrote on last edited by
                  #8

                  Do you think of a tool similar to Java's Web Start used by e.g. Continuous Integration tools like Hudson and Jenkins? Well, I do not know of such a component in the .Net world...

                  S 1 Reply Last reply
                  0
                  • B Bernhard Hiller

                    Do you think of a tool similar to Java's Web Start used by e.g. Continuous Integration tools like Hudson and Jenkins? Well, I do not know of such a component in the .Net world...

                    S Offline
                    S Offline
                    superselector
                    wrote on last edited by
                    #9

                    can i execute command in a windows box remotely over internet and get its output provided i have full details of credential required to connect to the remote machine. Through PSexec i am able excute command in remote machine in the LAN /intranet and get output in my local machine in a text file but will it be possible to get the same details if the remote machine is connected in Internet.

                    R 1 Reply Last reply
                    0
                    • S superselector

                      can i execute command in a windows box remotely over internet and get its output provided i have full details of credential required to connect to the remote machine. Through PSexec i am able excute command in remote machine in the LAN /intranet and get output in my local machine in a text file but will it be possible to get the same details if the remote machine is connected in Internet.

                      R Offline
                      R Offline
                      Ron Nicholson
                      wrote on last edited by
                      #10

                      Assuming you have the credentials and legal approval then the pc must be directly connected to the internet, meaning it must have an ip directly on the internet, or have port forwarding enabled on the router it sits behind. Normally you are not going to find pc's directly attached to the internet. Best practice is a firewall in between, which means you need to manually set up port forwarding at the pc's location.

                      1 Reply Last reply
                      0
                      • S superselector

                        I want to run a command in remote computer command prompt and fetch command output of the remote computer and save the output in local system. i don't want to use WMI for this as wmi is not enabled in the remote computer.

                        J Offline
                        J Offline
                        jschell
                        wrote on last edited by
                        #11

                        Lets start with the basics first. To execute a 'command' on a remote machine then the remote machine MUST have a server application running which will execute those commands. (Note that starting an application is also considered executing a command so you cannot expect to remotely start the application.) And that server application MUST be remotely accessible. That is an absolute. There is no other possibility. There are many applications that can do this - including writing your own. The FIRST step to implementing a solution is to determine what that server application will be. Because that will determine what the client application can do and what it can't do.

                        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