Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>
share|improve this question
    
Do you want the log saved on the local or remote machine? –  Alex Jurkiewicz Jun 29 '09 at 8:03
    
@Alex - updated question with that, thanks –  joshcomley Jun 29 '09 at 8:25
    
Hm, "psexec \\myserver ipconfig > output.log" works on my machine –  splattne Jun 29 '09 at 9:03
add comment

6 Answers

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

share|improve this answer
    
D'oh!! Could you link a copy of 1.94 on here? I cannot seem to find a copy online anywhere. Everytime I download "v1.94" it actually gives me 1.95 :( –  joshcomley Jun 29 '09 at 9:59
    
FYI: It's at v1.96 as of 06/29. –  Chris Jul 16 '09 at 12:01
add comment

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
share|improve this answer
add comment

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

share|improve this answer
    
Thanks Roy, but all I get is a blank output.log file, the same as with the examples I tried above :( –  joshcomley Jun 29 '09 at 8:29
    
Do yout get anything if you run psexec \\serverip ipconfig ? –  onesysadmin Jun 29 '09 at 8:39
    
@Roy - I've updated my question with the response to that at the bottom. Perhaps something deeper is going wrong here.. –  joshcomley Jun 29 '09 at 8:43
add comment

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
That's nice, but there's no indication that this would have anything to do with the OP's case. –  HopelessN00b Genius of network Nov 9 '12 at 21:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.