0

I using PC1 and PC2. PC1 is running the command and PC2 is the remote PC.

I am performing the following operation and I am trying to output it to a file but on PC1.

runas /user:[username] "psexec -e -h -s -u [username] -p [password] \\[IP] cmd /C ipconfig /displaydns > c:\[remotePC.txt]"

I need c:[remotePC.txt] to be output on the caller PC1. What is the correct syntax for this?

I tried the following but it doesn't work:

    runas /user:[username] "psexec -e -h -s -u [username] -p [password] \\[IP] cmd /C ipconfig /displaydns > \\[PC1 IP]\C$\log.txt"
1
  • So for the -u [username] -p [password] portion, can you confirm that this account/security context has applicable access to the \\[PC1 IP]\C$ admin share to write to it on PC1? Can you sign onto the machine you're running this process on but sign onto it with the -u [username] -p [password] you are running this process as otherwise and confirm that you can get to \\[PC1 IP]\C$, create a new file and write to it there? This should be a simple and easy way to troubleshoot this problem. Feb 20 '17 at 14:32
0

Output file should point to \\computer name\c$\filename.txt

3
  • I tried that but no file is created and no error is displayed. Thanks
    – ehh
    Feb 20 '17 at 12:57
  • Huh, say what, come again??? Feb 21 '17 at 2:29
  • As @Walmart mentioned, are you able to sign into the machine with the credentials you are providing? Feb 21 '17 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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