I'm trying to run multiple commands remotely using psexec.
I launch psexec from a local computer then specify the remote computer to connect. I want to store the output of the remote command on my local pc that initiated the psexec command.
If use ">" or ">>" the file gets created on the remote pc, not on my local pc.
Here is the code that I use:
cmd /c "c:\windows\system32\psexec.exe" \\192.168.0.2 -accepteula -u test -p test -s cmd /k (date /t) ^& (time /t) ^& (hostname) ^& (wmic csproduct get name, identifyingnumber) ^& (net statistics workstation) ^& (wmic LOGICALDISK LIST BRIEF) ^& (echo.) ^& (net use) ^& (tasklist)'+' ^& (echo.) ^& (echo. LISTARE CONTINUT FISIER HOSTS:) ^& (type c:\windows\system32\drivers\etc\hosts)
What am I doing wrong?