Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

psexec \MACHINE_NAME_HERE -u MACHINE_NAME_HERE\Administrator -p PASSWORD_HERE notepad

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

1 Answer 1

up vote 5 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

Your Answer

 
discard

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.