Search code examples
windowsinternet-explorerpsexec

Opening cmd using psexec to a specific remote directory


The goal is to delete the temporary internet files on a remote computer.

start psexec -u domain\username  -p password  -s \\xxx.xxx.xxx.xxx
cmd cd C:\Documents and Settings\USERACCOUNT\Local Settings\Temporary Internet Files

Which is connecting to the remote computer but just opening to c:windows\system. I am then able to cd to that directory and use del /f /s /q *.* to delete all the problem files.

I tried using psexec \\computer cmd /c del fileName but had even less luck with that.


Solution

  • I finally got it to work using

    psexec -u domain\user  -p password \\xxx.xxx.xxx.xxx -s cmd /c rd "C:\Documents and Settings\%USERACCOUNT%\Local Settings\Temporary Internet Files\Content.IE5\" /s /q
    

    which connects to the remote server, goes straight to the directory I want and proceeds to delete the particular temp internet files folder that's causing issues without bothering me at all.