Capturing output of remote process from sysinternal's psexec
Solution 1
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:
Solution 2
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"
Solution 3
Just be careful in which folder do you want to save the file output.log.
Store output.log locally:
psexec \\serverIP ipconfig > c:\output.logStore 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
Solution 4
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
Related videos on Youtube
Stinnux
Updated on September 17, 2022Comments
-
Stinnux almost 2 years
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>
-
Stinnux almost 15 yearsThanks Roy, but all I get is a blank output.log file, the same as with the examples I tried above :(
-
Jindrich almost 15 yearsDo yout get anything if you run psexec \\serverip ipconfig ?
-
Stinnux almost 15 years@Roy - I've updated my question with the response to that at the bottom. Perhaps something deeper is going wrong here..
-
Stinnux almost 15 yearsD'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 :(
-
Chris almost 15 yearsFYI: It's at v1.96 as of 06/29.
-
HopelessN00b over 11 yearsThat's nice, but there's no indication that this would have anything to do with the OP's case.
-
Maximilian Burszley over 6 yearsThis worked for me on Windows 10 LTSB. Great suggestion.
psexec -s -d "cmd /C ipconfig" > outputfile.txt 2>&1