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 can't seem to get psexec commands to work on Windows 7 Enterprise. I'm trying to execute a command like this:

psexec.exe \\172.16.165.157 -u jc -p testing123 -c -f -i cmd.exe

But, I keep getting the error:

PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com

Error copying C:\WINDOWS\system32\cmd.exe to remote system:
Access is denied.

I'm trying to execute the command from a machine running Windows XP Professional.

Has anybody seen an issue like this?

share|improve this question
    
how are you handling the authentication? –  tony roth Jun 30 '10 at 17:21
    
Have to ask, is there a reason why you don't want to use WinRM/PowerShell 2.0 remoting? –  amargeson Jun 30 '10 at 20:50
    
This is a legacy test automation system which I've been asked to maintain, I would use PowerShell, had I the choice! –  Jimmy C Jul 1 '10 at 8:13
add comment

5 Answers 5

up vote 1 down vote accepted

I’m seeing the same problem. I can get around it by using the -d argument, but that means I don’t get back the return code from the process I started remotely.

It gives the workaround, but not ideal.

share|improve this answer
add comment

If you are trying to do something that could generate a UAC prompt on the remote system, you need to use this:

     -h         If the target system is Vista or higher, has the process
                run with the account's elevated token, if available.

Copying cmd.exe from the system32 directory of a WinXP machine to the system32 directory of a Win7 machine is a very poorly conceived example. Please be careful. It is unwise to treat system files with such disrespect, especially across OS versions or architectures.

When you are using psexec, please specify a full path that is not within the c:\windows\ hierarchy on the remote system.

share|improve this answer
add comment

Presumably, there is a user account "jc" on the machine "172.16.165.157", with the password "testing123", and that account has "Administrator" rights there?

If the answer is "no" then this is your problem.

You don't want to copy "CMD.EXE" to the remote machine, either. It's already there. You don't need the "-c" flag on your PSEXEC command-line.

share|improve this answer
    
sometimes I need to read these things better! –  tony roth Jun 30 '10 at 17:33
    
Yes, an account with that name and admin rights exists on the system. I need the '-c' flag alright, I just used 'cmd.exe' as a example. I actually need to copy a number of tools to the system. It works fine on Windows XP, I just think there is some setting I haven't changed correctly on Windows 7. –  Jimmy C Jul 1 '10 at 8:15
add comment

Try -u computername\jc

share|improve this answer
    
If you do not specify a domain for the username, I am pretty sure -u jc is implicitly -u computername\jc. Just sayin'. –  ajstein Aug 23 '10 at 14:33
    
@alharaka: no it isn't the same, you get an access denied if you don't specify the computername. –  Luca Matteis Aug 24 '10 at 7:10
    
I just did the following with v1.96: psexec \\TESTPC -u Administrator cmd and pulled up a command prompt. That is a local account on a remote box. Did I miss something? I mean, you have to specify the computer name once before, is that what you meant? –  ajstein Aug 24 '10 at 13:48
add comment

Three things comes to my mind...

  1. Make sure to activate admin$ share on the target
  2. Even if you pass an admin user in the arguments with psexec you still need to run the psexec-command itself on the source as a administrator too.
  3. On the resent psexec there is a -h switch to overcome issues reaching Vista and above machines, although I haven't tested it.
share|improve this answer
add comment

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.