pmcfarland
pmcfarland

Reputation: 105

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.

Upvotes: 1

Views: 22311

Answers (4)

Swapnil Gangrade
Swapnil Gangrade

Reputation: 462

Use the below command to create a directory in remote location.

psexec \\\IPAddress -u username -p Password cmd /c mkdir c:\testfolder

Upvotes: 0

pmcfarland
pmcfarland

Reputation: 105

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.

Upvotes: 1

mradios
mradios

Reputation: 1

Your command is okay but missing the server name

psexec \\\servername -u ...

Upvotes: 0

mclaassen
mclaassen

Reputation: 5138

Why bother cd'ing to directory first? This should work:

psexec \\1.2.3.4 -u "domain\username" -p "password" cmd /c del /f /s /q "C:\Document and Settings\USERACCOUNT\Local Settings\Temporary Internet Files"

Upvotes: 1

Related Questions