Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to connect from a Win 7 machine to a Win2k8R2 machine using the command:


When I try this I get the error message:

Couldn't access MACHINE_NAME_HERE Access is denied.

I tried omitting the -p and manually putting in the password, but the same issue persists.

When I check the machine I'm trying to access I see that in the security event viewer that the Administrator login was successful, so I know the username password is correct, and the machine is accepting my login, but I also noticed that it tries to also log in with my domain account, which isn't in the admin list on the remote machine. If I add my domain account to the remote machine then everything works, but in this case it defeats the purpose, sometimes I need to be able to run commands on the machine when it's no on the domain.

The machine is set to use the simple model for Sharing and Security as well.

share|improve this question
I think Simple File Sharing will prevent the use of the Admin$ shares which are required by psexec. Try turning off Simple File Sharing. Also try the -i switch if you're trying to have something interact with the desktop. – explunit Mar 20 '13 at 20:35
up vote 20 down vote accepted

This is because psexec still tries to access the ADMIN$ share with your local credentials, before executing your command as another user. According to this thread, you can cache credentials before executing psexec:

cmdkey.exe /add:MACHINE_NAME_HERE /user:MACHINE_NAME_HERE\Administrator /pass:PASSWORD_HERE 
psexec.exe \\MACHINE_NAME_HERE -i notepad
cmdkey.exe /delete:MACHINE_NAME_HERE

I added -i, since you specified running notepad here. Without the -i, notepad will sit idle with no interacton. Also, please remembet that, when you use -u, psexec will send the password in plaintext.

share|improve this answer
Thanks a bunch this fixed it perfectly, you're my hero. – Zipper Mar 20 '13 at 22:49
+1 This helped me today :-) – Kin Sep 14 '15 at 21:24
The last message by Lxocram of Oct 15, 2015 in the Sysinternals thread suggests that specifying \\localhost works the issue around. I do not know the root cause, but using \\localhost worked for me. – eel ghEEz Feb 25 at 1:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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