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>
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
Hope this can help someone. I was able to run PSExec with the following command on Windows 10 and a remote Windows 10 instance.
Command
Just be careful in which folder do you want to save the file 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
Only way I found is to create a quick bat script:
Or replace
%2
with the command/args you want.Run with remote-psexec
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"
I had the same issue and had to tell PSEXEC to run as an admin user on the remote machine:
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.
I found that using a FQDN for the servername solved my issue.