2

runas is already installed on many systems (maybe by default) psexec is shipped with the awesome PsTools.

Why would I use psexec (an external tool) instead of runas(an included tool) ?

What are the differences between them?

user454322
  • 159
  • 1
  • 7
  • 2
    Yes, `runas` is provided by default with Windows. The main difference is `runas` will only work locally, while `psexec` was designed to work with remote computers. – jscott Aug 10 '12 at 10:40
  • 1
    This is a question that just begs an RTFM answer. – John Gardeniers Aug 10 '12 at 12:15
  • @JohnGardeniers And got 2 upvotes instead. :/ – HopelessN00b Aug 10 '12 at 23:11
  • One additional trick psexec can do (and runas can't) is to run a program in local system context. There are some things that are easier to do as local system than as administrator. – Harry Johnston Aug 11 '12 at 08:59
  • @JohnGardeniers Don't see the reason why asking a legit question, related to servers in Q&A site for servers would beg for RTFM. I read the manual before, just that coming from *nix where after `@` a remote host can be specified (ssh for example), got confused with the syntax `USER@DOMAIN` of `runas` assuming that specifying a _remote domain_ was possible, so I thought that `runas` could execute commands in remote machines as `psexec` or `ssh`. – user454322 Aug 25 '12 at 20:44
  • The comment doesn't even relate to the question. – John Gardeniers Aug 25 '12 at 22:14
  • @JohnGardeniers my comment does relate to your comment _This is a question that just begs an RTFM answer._ Although the question is not a difficult one, would you kindly comment on _why asking a legit question, related to servers in Q&A site for servers would beg for RTFM_ =) – user454322 Sep 07 '12 at 10:14
  • Because if you had taken a moment to read the documentation on the two commands you would not need to post the question. How much more obvious can it be? – John Gardeniers Sep 07 '12 at 10:17
  • As I wrote above, I read the manual before to post the question and I didn't get the difference, that is why I call it _a legit question_ .... No need of RTFM comments nor answers, not every one here is so clever – user454322 Sep 07 '12 at 12:10

2 Answers2

1

Of course psexec is no longer an external tool - SysInternals is now part of Microsoft (since 2006, I believe)

From Mark Russinovitch:

Many Windows administrative console tools can run only on a local machine. PsExec lets you remote-enable any of them.

Have a good look through the psexec page here.

Rory Alsop
  • 1,184
  • 11
  • 21
  • Thank you for the answer. Does this mean that there is no such thing as `runas /env /user:jdoe@remote_domain.com`? Where _remote_domain.com_ refers to a "non-local domain" I already knew the article. – user454322 Aug 10 '12 at 18:00
  • I was aware that SysInternals is now part of Microsoft, with "external" I meant that *psexec* is not installed by default. – user454322 Aug 10 '12 at 18:16
  • 3
    @user454322: runas can handle a domain user account, but the program you're starting is still going to run on the local computer and on the current desktop. Psexec is normally used when you want to make a program run on *another* computer, or sometimes when you want to make it run on the local computer but in a different session. – Harry Johnston Aug 11 '12 at 08:57
1

One of the most important features of psexec (at least for me):
fully detach child from parent
it closes all parent inherited file descriptors (as opposite to start)

bua
  • 261
  • 2
  • 7
  • Interesting... Assuming the following command is ran from cmd, `runas /env /user:jdoe@mydomain program` would `program` be able to access the file descriptors of cmd? Any documentation/reference? – user454322 Aug 10 '12 at 18:14