20

I'm trying to capture the output of the remote process from psexec (i.e. not psexec's own output). So, for example I could run "ipconfig" and print the output to a log file.

I have tried:

psexec \\myserver ipconfig > output.log
psexec \\myserver ipconfig >> output.log
psexec \\myserver ipconfig 2> output.log
psexec \\myserver ipconfig > output.log 2>&1

The last just gives the psexec output.

I'n not sure what the differences are between all of these, but I've seen them suggested in my hunt for the answer elsewhere.

Can anybody give me an example command line that will capture the output of ipconfig to a file??

Edit 1: I want the log file to be saved on the local machine, not the remote one.

Edit 2:

Here is what I get from running "psexec \\myserver ipconfig":

C:\TempDll>psexec \\myserver ipconfig

PsExec v1.95 - Execute processes remotely
Copyright (C) 2001-2009 Mark Russinovich
Sysinternals - www.sysinternals.com


ipconfig exited on myserver with error code 0.

C:\TempDll>
HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
joshcomley
  • 311
  • 1
  • 4
  • 6

8 Answers8

3

Possibly a bug in PsExec in v1.95?

I have v1.94 and get the output fine but i've just downloaded the latest copy and get the same problems as yourself.

EDIT:

PsExec on my public SkyDrive

RhysSH
  • 51
  • 1
  • 3
3

Hope this can help someone. I was able to run PSExec with the following command on Windows 10 and a remote Windows 10 instance.

psexec \\ipaddress cmd /c "ipconfig>c:\Tools\output.txt"

Command

IanC
  • 131
  • 2
1

Just be careful in which folder do you want to save the file output.log.

Store output.log locally:
psexec \\serverIP ipconfig > c:\output.log

Store output.log on a remote machine:
psexec \\serverIP ipconfig > \\ipaddress\c$\output.log

psexec ... > output.log will overwrite file output.log in case it exists.
psexec ... >> output.log will append the output at the end.

You can also run psexec \\serverIP cmd, change your directory on a remote machine and simply run ipconfig > output.log

Jindrich
  • 4,958
  • 8
  • 29
  • 42
1

Only way I found is to create a quick bat script:

psexec %1 %2

Or replace %2 with the command/args you want.

Run with remote-psexec

\\systemname systeminfo | more
Scott Pack
  • 14,717
  • 10
  • 51
  • 83
1

If you want to save output locally on remote machine. you may use below command. psexec \myserver cmd /c "ipconfig >output.log"

If you want to redirect output from remote machine to hosted machine. you may use below command psexec \myserver cmd /c "ipconfig>\localmachine\location\output.log"

0

I found that using a FQDN for the servername solved my issue.

MattB
  • 1
0

I had the same issue and had to tell PSEXEC to run as an admin user on the remote machine:

psexec \\serverIP -u DOMAINNAME\username -p PaSsWoRd ipconfig /all > c:\output.log
0

The only time you need to specify a username and password with PSExec is if you need to pull data from a network share. I strongly recommend against it though, as the password is sent in cleartext, meaning anyone listening to traffic now has your username and password.